public final class AttributeSelector extends AbstractSelectorPart implements SimpleSelector
AttributeSelectorParser
Constructor and Description |
---|
AttributeSelector(int line,
int column,
String attribute)
Creates a new instance with the given line and column numbers.
|
AttributeSelector(String attribute)
Creates a new instance with no line or number specified (used for dynamically created
Syntax units). |
Modifier and Type | Method and Description |
---|---|
String |
attribute()
Gets the attribute value.
|
AttributeSelector |
attribute(String attribute)
Sets the attribute value.
|
AttributeSelector |
copy()
For implementations: do not copy comments or orphaned comments, instead be sure to call
AbstractSyntax.copiedFrom(Syntax) on the
new copy. |
AttributeSelector |
match(AttributeMatchType matchType,
String value)
Specifies the match type and expected match value.
|
AttributeSelector |
matchAll()
Removes the match type and value, if present.
|
Optional<AttributeMatchType> |
matchType()
Gets the
AttributeMatchType (e.g., "=", "^=", "~=", etc...), if present. |
SelectorPartType |
type()
Gets the
SelectorPartType of this SelectorPart . |
Optional<String> |
value()
Gets the match value, if present.
|
void |
write(StyleWriter writer,
StyleAppendable appendable)
Outputs this
Writable 's string representation. |
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
parent
append, destroy, group, group, isDestroyed, isFirst, isLast, next, 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 AttributeSelector(int line, int column, String attribute)
If dynamically creating a new instance then use AttributeSelector(String)
instead.
line
- The line number.column
- The column number.attribute
- The the attribute.public AttributeSelector(String attribute)
Syntax
units).attribute
- The attribute.public AttributeSelector attribute(String attribute)
attribute
- The attribute.public String attribute()
public AttributeSelector match(AttributeMatchType matchType, String value)
matchAll()
instead.matchType
- The match type.value
- The match value.public AttributeSelector matchAll()
[href='blah']
becomes [href]
.public Optional<AttributeMatchType> matchType()
AttributeMatchType
(e.g., "=", "^=", "~=", etc...), if present.AttributeMatchType
, or an empty Optional
if not present.public Optional<String> value()
Optional
if not present.public SelectorPartType type()
SelectorPart
type
in interface SelectorPart
SelectorPartType
.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 AttributeSelector copy()
AbstractSyntax
AbstractSyntax.copiedFrom(Syntax)
on the
new copy.copy
in interface SelectorPart
copy
in interface SimpleSelector
copy
in interface Syntax
copy
in class AbstractSyntax
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.