public final class Combinator extends AbstractSelectorPart implements SimpleSelector
CombinatorParser
Constructor and Description |
---|
Combinator(CombinatorType type)
Creates a new instance with no line or number specified (used for dynamically created
Syntax units). |
Combinator(int line,
int column,
CombinatorType type)
Creates a new instance with the given line and column numbers, and the
CombinatorType . |
Modifier and Type | Method and Description |
---|---|
static Combinator |
adjacent()
Creates a new adjacent sibling
Combinator ("+"). |
static Combinator |
child()
Creates a new child
Combinator (">"). |
Combinator |
copy()
For implementations: do not copy comments or orphaned comments, instead be sure to call
AbstractSyntax.copiedFrom(Syntax) on the
new copy. |
static Combinator |
descendant()
Creates a new descendant
Combinator (" "). |
static Combinator |
general()
Creates a new general sibling
Combinator ("~"). |
SelectorPartType |
type()
Gets the
SelectorPartType of this SelectorPart . |
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 Combinator(CombinatorType type)
Syntax
units).type
- The CombinatorType
.public Combinator(int line, int column, CombinatorType type)
CombinatorType
.
If dynamically creating a new instance then use Combinator(CombinatorType)
instead.
line
- The line number.column
- The column number.type
- The CombinatorType
.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 Combinator 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
public static Combinator descendant()
Combinator
(" "). Usually used when dynamically creating Selector
s.
Example:
new Selector(new IdSelector("name"), Combinator.descendant(), new ClassSelector("myClass"));
Combinator
instance.public static Combinator child()
Combinator
(">"). Usually used when dynamically creating Selector
s.
Example:
new Selector(new IdSelector("name"), Combinator.child(), new ClassSelector("myClass"));
Combinator
instance.public static Combinator adjacent()
Combinator
("+"). Usually used when dynamically creating Selector
s.
Example:
new Selector(new IdSelector("name"), Combinator.adjacent(), new ClassSelector("myClass"));
Combinator
instance.public static Combinator general()
Combinator
("~"). Usually used when dynamically creating Selector
s.
Example:
new Selector(new IdSelector("name"), Combinator.general(), new ClassSelector("myClass"));
Combinator
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.