Package org.apache.sis.io.wkt
Class Colors
java.lang.Object
org.apache.sis.io.wkt.Colors
- All Implemented Interfaces:
Serializable
,Cloneable
The colors to use for formatting Well Known Text (WKT) objects.
Colors are identified by their names and can be mapped to
ElementKind
.
The currently supported color names are:
"red"
,"green"
,"yellow"
,"blue"
,"magenta"
,"cyan"
,"gray"
.
- Since:
- 0.4
- Version:
- 0.4
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Colors
The default colors used byFormattableObject.print()
.private boolean
true
if this instance shall be considered as immutable.private EnumMap<ElementKind,
X364> The map of colors.static final Colors
Emphases on identification information (name and identifiers) only.private static final long
For cross-version compatibility. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of thisColors
.boolean
Compares thisColors
with the given object for equality.(package private) final String
Returns the ANSI sequence for the given syntactic element, ornull
if none.final String
getName
(ElementKind key) Returns the color for the given syntactic element.int
hashCode()
Returns a hash code value for this object.(package private) final Colors
Returns an immutable copy of this set of colors, orthis
if this instance is already immutable.(package private) final Object
Replaces the deserialized instance byDEFAULT
one if possible.void
setName
(ElementKind key, String color) Sets the color of the given syntactic element from a color name.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
DEFAULT
The default colors used byFormattableObject.print()
. Those colors give better results on aConsole
with black background. This map is immutable.- See Also:
-
NAMING
Emphases on identification information (name and identifiers) only. This map is immutable. -
map
The map of colors. Consider this field as final — it is modified only byclone()
. -
isImmutable
private boolean isImmutabletrue
if this instance shall be considered as immutable.
-
-
Constructor Details
-
Colors
public Colors()Creates a new, initially empty, set of colors. -
Colors
Creates a new set of colors initialized to a copy of the given one.- Parameters:
colors
- the set of colors to copy.
-
-
Method Details
-
setName
Sets the color of the given syntactic element from a color name. The color names supported in the current implementation are"red"
,"green"
,"yellow"
,"blue"
,"magenta"
,"cyan"
and"gray"
, case-insensitive.- Parameters:
key
- the syntactic element for which to set the color.color
- the color to give to the specified element, ornull
if none.- Throws:
IllegalArgumentException
- if the given color name is not recognized.UnsupportedOperationException
- if thisColors
instance is immutable.
-
getName
Returns the color for the given syntactic element.- Parameters:
key
- the syntactic element for which to get the color.- Returns:
- the color of the specified element, or
null
if none.
-
getAnsiSequence
Returns the ANSI sequence for the given syntactic element, ornull
if none. -
immutable
Returns an immutable copy of this set of colors, orthis
if this instance is already immutable. -
clone
Returns a clone of thisColors
. -
equals
Compares thisColors
with the given object for equality. -
hashCode
public int hashCode()Returns a hash code value for this object. -
readResolve
Replaces the deserialized instance byDEFAULT
one if possible.- Returns:
- the object to use after deserialization.
- Throws:
ObjectStreamException
- required by specification but should never be thrown.
-