Class Attribute
- All Implemented Interfaces:
IAttribute
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final int(package private) final String(package private) static final String(package private) final AttributeDefinition(package private) final int(package private) final Stringprivate IStandardExpression(package private) final String(package private) final String(package private) final AttributeValueQuotes -
Constructor Summary
ConstructorsConstructorDescriptionAttribute(AttributeDefinition definition, String completeName, String operator, String value, AttributeValueQuotes valueQuotes, String templateName, int line, int col) -
Method Summary
Modifier and TypeMethodDescriptionReturns the complete name of the attribute, exactly as it was written in the original template (if it did appear there).Returns theAttributeDefinitioncorresponding to this attribute.(package private) IStandardExpressionintgetCol()Returns the column at which this attribute can be found in the template specified byIAttribute.getTemplateName().intgetLine()Returns the line at which this attribute can be found in the template specified byIAttribute.getTemplateName().Returns the operator specified for this attribute.Returns the name of the template from which parsing this attribute was originally created.getValue()Returns the value of this attribute, or null if it has none.Returns the type of quotes surrounding the attribute value.final booleanChecks whether this attribute contains location information (template name, line and column).(package private) Attributemodify(AttributeDefinition definition, String completeName, String value, AttributeValueQuotes valueQuotes) (package private) voidsetCachedStandardExpression(IStandardExpression standardExpression) toString()voidWrites this attribute to the specifiedWriter.
-
Field Details
-
DEFAULT_OPERATOR
- See Also:
-
definition
-
completeName
-
operator
-
value
-
valueQuotes
-
templateName
-
line
final int line -
col
final int col -
standardExpression
-
-
Constructor Details
-
Attribute
Attribute(AttributeDefinition definition, String completeName, String operator, String value, AttributeValueQuotes valueQuotes, String templateName, int line, int col)
-
-
Method Details
-
getAttributeDefinition
Description copied from interface:IAttributeReturns the
AttributeDefinitioncorresponding to this attribute.The attribute definition contains several metadata related to the attribute. For example, if the template mode is
TemplateMode.HTML, an attribute definition could specify whether the attribute is boolean (represents a true/false value by appearing or not appearing at a specific tag).- Specified by:
getAttributeDefinitionin interfaceIAttribute- Returns:
- the attribute definition.
-
getAttributeCompleteName
Description copied from interface:IAttributeReturns the complete name of the attribute, exactly as it was written in the original template (if it did appear there).
- Specified by:
getAttributeCompleteNamein interfaceIAttribute- Returns:
- the complete name.
-
getOperator
Description copied from interface:IAttributeReturns the operator specified for this attribute.
The operator itself, if present, is always an equals sign (
=), but the reason this is specified as a separate field is that it could be surrounded by white space, which should be respected in output when present at the input template.If the attribute is specified without a value at all (and therefore no operator either), this method will return null.
- Specified by:
getOperatorin interfaceIAttribute- Returns:
- the attribute operator (might be null if no value specified).
-
getValue
Description copied from interface:IAttributeReturns the value of this attribute, or null if it has none.
A null-valued attribute is an attribute of which only the name has been specified (only allowed in HTML mode).
- Specified by:
getValuein interfaceIAttribute- Returns:
- the value of this attribute, or null if it has none.
-
getValueQuotes
Description copied from interface:IAttributeReturns the type of quotes surrounding the attribute value.
- Specified by:
getValueQuotesin interfaceIAttribute- Returns:
- the
AttributeValueQuotesvalue representing the attribute value quotes (might be null).
-
getTemplateName
Description copied from interface:IAttributeReturns the name of the template from which parsing this attribute was originally created.
- Specified by:
getTemplateNamein interfaceIAttribute- Returns:
- the name of the template
-
hasLocation
public final boolean hasLocation()Description copied from interface:IAttributeChecks whether this attribute contains location information (template name, line and column).
Only attributes that are generated during the parsing of templates contain location info, locating them in their original template. All attributes generated during template processing and not originally present at the template do not contain this location data.
- Specified by:
hasLocationin interfaceIAttribute- Returns:
- whether the attribute contains location data or not.
-
getLine
public int getLine()Description copied from interface:IAttributeReturns the line at which this attribute can be found in the template specified by
IAttribute.getTemplateName().- Specified by:
getLinein interfaceIAttribute- Returns:
- the line number, starting in 1.
-
getCol
public int getCol()Description copied from interface:IAttributeReturns the column at which this attribute can be found in the template specified by
IAttribute.getTemplateName().- Specified by:
getColin interfaceIAttribute- Returns:
- the column number, starting in 1.
-
getCachedStandardExpression
IStandardExpression getCachedStandardExpression() -
setCachedStandardExpression
-
modify
Attribute modify(AttributeDefinition definition, String completeName, String value, AttributeValueQuotes valueQuotes) -
write
Description copied from interface:IAttributeWrites this attribute to the specified
Writer.This is usually called as a part of
ITemplateEvent.write(Writer).- Specified by:
writein interfaceIAttribute- Parameters:
writer- the writer this attribute should be written to.- Throws:
IOException- if an input/output exception occurs.
-
toString
-