public final class HexColorValue extends AbstractTerm
HexColorValue
Constructor and Description |
---|
HexColorValue(int line,
int column,
String color)
Constructs a new instance of a
HexColorValue . |
HexColorValue(String color)
Constructs a new instance of a
HexColorValue (used for dynamically created Syntax units). |
HexColorValue(String color,
boolean lowerCaseAndNoHex)
Constructs a new instance of a
HexColorValue (used for dynamically created Syntax units). |
Modifier and Type | Method and Description |
---|---|
String |
color()
Gets the color value (does not include the #).
|
HexColorValue |
color(String color)
Sets the value of the color (will be converted to lower-case).
|
HexColorValue |
copy()
For implementations: do not copy comments or orphaned comments, instead be sure to call
AbstractSyntax.copiedFrom(Syntax) on the
new copy. |
boolean |
isShorthand()
Gets whether this hex color is shorthand (has a length of three).
|
static HexColorValue |
of(String color)
Creates a new
HexColorValue instance using the given color (do not include the #). |
String |
textualValue()
Gets the color value (does not include the #).
|
void |
write(StyleWriter writer,
StyleAppendable appendable)
Outputs this
Writable 's string representation. |
declaration, isTerm, self
append, destroy, group, group, isDestroyed, isFirst, isLast, isWritable, next, parent, prepend, previous, replaceWith, unlink
annotate, annotateUnlessPresent, annotation, annotations, column, comment, comment, comments, comments, comments, copiedFrom, equals, hasAnnotation, hasAnnotation, hashCode, hasSourcePosition, id, line, orphanedComments, orphanedComments, orphanedComments, propagateBroadcast, shouldBreakBroadcast, status, status, toString, toString, writesOwnComments, writesOwnOrphanedComments
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
append, destroy, group, group, isDestroyed, isFirst, isLast, next, parent, prepend, previous, replaceWith, unlink
annotate, annotateUnlessPresent, annotation, annotations, column, comment, comment, comments, comments, comments, hasAnnotation, hasAnnotation, hasSourcePosition, id, line, orphanedComments, orphanedComments, orphanedComments, toString, writesOwnComments, writesOwnOrphanedComments
isWritable
propagateBroadcast, shouldBreakBroadcast, status, status
public HexColorValue(int line, int column, String color)
HexColorValue
.
If dynamically creating a new instance then use HexColorValue(String)
instead.
line
- The line number.column
- The column number.color
- The hex color (do not include the #). Automatically lower-cased.public HexColorValue(String color)
HexColorValue
(used for dynamically created Syntax
units).color
- The hex color (do not include the #).public HexColorValue(String color, boolean lowerCaseAndNoHex)
HexColorValue
(used for dynamically created Syntax
units). Only use this
when you already know the string is lower-cased and doesn't start with a '#'.color
- The hex color (do not include the #).lowerCaseAndNoHex
- Specifies whether the string is already lower-cased and doesn't start with a '#'.public HexColorValue color(String color)
color
- The hex color (do not include the #). Automatically lower-cased.public String color()
public boolean isShorthand()
public String textualValue()
color()
, which is identical to this method.public void write(StyleWriter writer, StyleAppendable appendable) throws IOException
Writable
Writable
's string representation.
Important notes for implementation:
Do not use the StyleWriter
in an attempt to write direct content (Strings, chars, etc...). Use the StyleAppendable
.
The StyleWriter
should be used to make decisions based on writer settings (e.g., compressed vs. verbose output
mode), as well as for writing inner or child Writable
s. Do not call the this method method directly on inner
or child Writable
s! That would bypass any overrides that are set on the StyleWriter
. Use StyleWriter.writeInner(Writable, StyleAppendable)
instead.
writer
- Writer to use for output settings and for writing inner Writable
s.appendable
- Append direct content to this StyleAppendable
.IOException
- If an I/O error occurs.public HexColorValue copy()
AbstractSyntax
AbstractSyntax.copiedFrom(Syntax)
on the
new copy.copy
in interface PropertyValueMember
copy
in interface Term
copy
in interface Syntax
copy
in class AbstractSyntax
public static HexColorValue of(String color)
HexColorValue
instance using the given color (do not include the #).
Example:
HexColorValue.of("fffeee")
color
- The color value. Automatically lower-cased.HexColorValue
instance.Copyright (c) 2019, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE file in the repository.