public final class KeywordValue extends AbstractTerm implements Named
KeywordValueParser
Constructor and Description |
---|
KeywordValue(int line,
int column,
String keyword)
Constructs a new
KeywordValue instance. |
KeywordValue(Keyword keyword)
Constructs a new
KeywordValue instance with the given Keyword (used for dynamically created Syntax
units). |
KeywordValue(String keyword)
Constructs a new
KeywordValue instance (used for dynamically created Syntax units). |
Modifier and Type | Method and Description |
---|---|
Optional<Keyword> |
asKeyword()
Gets the exact matching
Keyword instance, if one exists (it may not exist if this is an unknown keyword). |
KeywordValue |
copy()
For implementations: do not copy comments or orphaned comments, instead be sure to call
AbstractSyntax.copiedFrom(Syntax) on the
new copy. |
String |
keyword()
Gets the keyword value.
|
KeywordValue |
keyword(Keyword keyword)
Sets the keyword value.
|
KeywordValue |
keyword(String keyword)
Sets the keyword value.
|
String |
name()
Gets the name of this object.
|
static KeywordValue |
of(Keyword keyword)
Creates a new
KeywordValue instance from the given Keyword . |
static KeywordValue |
of(String keyword)
Creates a new
KeywordValue instance from the given keyword string. |
String |
textualValue()
Gets the keyword value.
|
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 KeywordValue(int line, int column, String keyword)
KeywordValue
instance.
If dynamically creating a new instance then use KeywordValue(Keyword)
or KeywordValue(String)
instead.
line
- The line number.column
- The column number.keyword
- The keyword.public KeywordValue(String keyword)
KeywordValue
instance (used for dynamically created Syntax
units). Prefer KeywordValue(Keyword)
over this.keyword
- The keyword.public KeywordValue(Keyword keyword)
KeywordValue
instance with the given Keyword
(used for dynamically created Syntax
units).keyword
- The keyword.public KeywordValue keyword(String keyword)
keyword(Keyword)
over this one.keyword
- The keyword.public KeywordValue keyword(Keyword keyword)
keyword
- The keyword.public String keyword()
public Optional<Keyword> asKeyword()
Keyword
instance, if one exists (it may not exist if this is an unknown keyword).Keyword
.public String textualValue()
keyword()
, which is identical to this method.textualValue
in interface Term
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.
write
in interface Writable
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 KeywordValue 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 KeywordValue of(String keyword)
KeywordValue
instance from the given keyword string. Prefer to use of(Keyword)
over this.
Example:
KeywordValue.of("left");
keyword
- The keyword.KeywordValue
instance.public static KeywordValue of(Keyword keyword)
keyword
- The keyword.KeywordValue
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.