public interface IAttribute
Interface defining an attribute contained in a tag.
Container tags are implementations of IProcessableElementTag
.
Note that any implementations of this interface should be immutable.
Modifier and Type | Method and Description |
---|---|
String |
getAttributeCompleteName()
Returns the complete name of the attribute, exactly as it was written in the original template (if it
did appear there).
|
AttributeDefinition |
getAttributeDefinition()
Returns the
AttributeDefinition corresponding to this attribute. |
int |
getCol()
Returns the column at which this attribute can be found in the template specified by
getTemplateName() . |
int |
getLine()
Returns the line at which this attribute can be found in the template specified by
getTemplateName() . |
String |
getOperator()
Returns the operator specified for this attribute.
|
String |
getTemplateName()
Returns the name of the template from which parsing this attribute was originally created.
|
String |
getValue()
Returns the value of this attribute, or null if it has none.
|
AttributeValueQuotes |
getValueQuotes()
Returns the type of quotes surrounding the attribute value.
|
boolean |
hasLocation()
Checks whether this attribute contains location information (template name, line and column).
|
void |
write(Writer writer)
Writes this attribute to the specified
Writer . |
String getAttributeCompleteName()
Returns the complete name of the attribute, exactly as it was written in the original template (if it did appear there).
AttributeDefinition getAttributeDefinition()
Returns the AttributeDefinition
corresponding 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).
String getOperator()
Returns 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.
String getValue()
Returns 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).
AttributeValueQuotes getValueQuotes()
Returns the type of quotes surrounding the attribute value.
AttributeValueQuotes
value representing the attribute value quotes (might be null).boolean hasLocation()
Checks 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.
String getTemplateName()
Returns the name of the template from which parsing this attribute was originally created.
int getLine()
Returns the line at which this attribute can be found in the template specified by getTemplateName()
.
int getCol()
Returns the column at which this attribute can be found in the template specified by getTemplateName()
.
void write(Writer writer) throws IOException
Writes this attribute to the specified Writer
.
This is usually called as a part of ITemplateEvent.write(Writer)
.
writer
- the writer this attribute should be written to.IOException
- if an input/output exception occurs.Copyright © 2017 The THYMELEAF team. All rights reserved.