Class Attribute
- java.lang.Object
-
- org.thymeleaf.engine.Attribute
-
- All Implemented Interfaces:
IAttribute
final class Attribute extends java.lang.Object implements IAttribute
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intcol(package private) java.lang.StringcompleteName(package private) static java.lang.StringDEFAULT_OPERATOR(package private) AttributeDefinitiondefinition(package private) intline(package private) java.lang.Stringoperatorprivate IStandardExpressionstandardExpression(package private) java.lang.StringtemplateName(package private) java.lang.Stringvalue(package private) AttributeValueQuotesvalueQuotes
-
Constructor Summary
Constructors Constructor Description Attribute(AttributeDefinition definition, java.lang.String completeName, java.lang.String operator, java.lang.String value, AttributeValueQuotes valueQuotes, java.lang.String templateName, int line, int col)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAttributeCompleteName()Returns the complete name of the attribute, exactly as it was written in the original template (if it did appear there).AttributeDefinitiongetAttributeDefinition()Returns theAttributeDefinitioncorresponding to this attribute.(package private) IStandardExpressiongetCachedStandardExpression()intgetCol()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().java.lang.StringgetOperator()Returns the operator specified for this attribute.java.lang.StringgetTemplateName()Returns the name of the template from which parsing this attribute was originally created.java.lang.StringgetValue()Returns the value of this attribute, or null if it has none.AttributeValueQuotesgetValueQuotes()Returns the type of quotes surrounding the attribute value.booleanhasLocation()Checks whether this attribute contains location information (template name, line and column).(package private) Attributemodify(AttributeDefinition definition, java.lang.String completeName, java.lang.String value, AttributeValueQuotes valueQuotes)(package private) voidsetCachedStandardExpression(IStandardExpression standardExpression)java.lang.StringtoString()voidwrite(java.io.Writer writer)Writes this attribute to the specifiedWriter.
-
-
-
Field Detail
-
DEFAULT_OPERATOR
static final java.lang.String DEFAULT_OPERATOR
- See Also:
- Constant Field Values
-
definition
final AttributeDefinition definition
-
completeName
final java.lang.String completeName
-
operator
final java.lang.String operator
-
value
final java.lang.String value
-
valueQuotes
final AttributeValueQuotes valueQuotes
-
templateName
final java.lang.String templateName
-
line
final int line
-
col
final int col
-
standardExpression
private volatile IStandardExpression standardExpression
-
-
Constructor Detail
-
Attribute
Attribute(AttributeDefinition definition, java.lang.String completeName, java.lang.String operator, java.lang.String value, AttributeValueQuotes valueQuotes, java.lang.String templateName, int line, int col)
-
-
Method Detail
-
getAttributeDefinition
public AttributeDefinition 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
public java.lang.String 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
public java.lang.String 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
public java.lang.String 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
public AttributeValueQuotes 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
public java.lang.String 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
void setCachedStandardExpression(IStandardExpression standardExpression)
-
modify
Attribute modify(AttributeDefinition definition, java.lang.String completeName, java.lang.String value, AttributeValueQuotes valueQuotes)
-
write
public void write(java.io.Writer writer) throws java.io.IOExceptionDescription 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:
java.io.IOException- if an input/output exception occurs.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-