public final class PseudoClassSelector extends AbstractSelectorPart implements SimpleSelector, Named
Note that even though some pseudo elements can be written using the pseudo class format, they are not considered pseudo
classes in this parser, but as PseudoElementSelector
s.
PseudoSelectorParser
Constructor and Description |
---|
PseudoClassSelector(int line,
int column,
String name,
String args)
Constructs a new
PseudoClassSelector instance with the given name and optional args. |
PseudoClassSelector(String name)
Creates a new instance with no line or number specified (used for dynamically created
Syntax units). |
PseudoClassSelector(String name,
String args)
Creates a new instance with no line or number specified (used for dynamically created
Syntax units). |
Modifier and Type | Method and Description |
---|---|
Optional<String> |
args()
Gets the arguments of the pseudo selector (e.g., "2n+1").
|
PseudoClassSelector |
args(String args)
Specifies the arguments of the pseudo selector (e.g., "2n+1").
|
PseudoClassSelector |
copy()
For implementations: do not copy comments or orphaned comments, instead be sure to call
AbstractSyntax.copiedFrom(Syntax) on the
new copy. |
String |
name()
Gets the name of this object.
|
PseudoClassSelector |
name(String name)
Sets the name of the selector (e.g., "hover").
|
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 PseudoClassSelector(int line, int column, String name, String args)
PseudoClassSelector
instance with the given name and optional args.
If dynamically creating a new instance then use PseudoClassSelector(String)
or PseudoClassSelector(String,
String)
instead.
line
- The line number.column
- The column number.name
- Name of the pseudo class.args
- Optional arguments for the pseudo class selector (null is ok for no args).public PseudoClassSelector(String name)
Syntax
units).name
- Name of the pseudo class.public PseudoClassSelector name(String name)
name
- The new name.public PseudoClassSelector args(String args)
If null is specified then the arguments will be removed.
args
- The arguments (not including the parenthesis).public Optional<String> args()
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 PseudoClassSelector 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.