public final class CommandTagAttribute extends Object
<name>="<attribute>") as parsed from a soy command.| Modifier and Type | Field and Description |
|---|---|
static SoyErrorKind |
MISSING_ATTRIBUTE |
static SoyErrorKind |
UNSUPPORTED_ATTRIBUTE_KEY |
static SoyErrorKind |
UNSUPPORTED_ATTRIBUTE_KEY_SINGLE |
| Constructor and Description |
|---|
CommandTagAttribute(Identifier key,
QuoteStyle quoteStyle,
com.google.common.collect.ImmutableList<ExprNode> valueExprList) |
CommandTagAttribute(Identifier key,
QuoteStyle quoteStyle,
String value,
SourceLocation valueLocation) |
| Modifier and Type | Method and Description |
|---|---|
Identifier |
getName()
Returns the name.
|
String |
getValue()
Returns the string value.
|
SourceLocation |
getValueLocation() |
boolean |
hasName(String name)
Returns true if the attribute name is equal to the given string.
|
static void |
removeDuplicatesAndReportErrors(Iterable<CommandTagAttribute> attrs,
ErrorReporter errorReporter)
Identifies duplicate attributes, reports an error for each one, and removes them from the
Iterable. |
String |
toString() |
SanitizedContentKind |
valueAsContentKind(ErrorReporter errorReporter) |
ExprNode |
valueAsExpr(ErrorReporter reporter)
Returns the value as an expression.
|
com.google.common.collect.ImmutableList<ExprNode> |
valueAsExprList()
Returns the value as an expression list.
|
int |
valueAsInteger(ErrorReporter errorReporter,
int defaultValue) |
public static final SoyErrorKind MISSING_ATTRIBUTE
public static final SoyErrorKind UNSUPPORTED_ATTRIBUTE_KEY
public static final SoyErrorKind UNSUPPORTED_ATTRIBUTE_KEY_SINGLE
public CommandTagAttribute(Identifier key, QuoteStyle quoteStyle, String value, SourceLocation valueLocation)
public CommandTagAttribute(Identifier key, QuoteStyle quoteStyle, com.google.common.collect.ImmutableList<ExprNode> valueExprList)
public static void removeDuplicatesAndReportErrors(Iterable<CommandTagAttribute> attrs, ErrorReporter errorReporter)
Iterable.public Identifier getName()
public boolean hasName(String name)
public String getValue()
public SourceLocation getValueLocation()
public int valueAsInteger(ErrorReporter errorReporter, int defaultValue)
@Nullable public SanitizedContentKind valueAsContentKind(ErrorReporter errorReporter)
public ExprNode valueAsExpr(ErrorReporter reporter)
public com.google.common.collect.ImmutableList<ExprNode> valueAsExprList()