org.thymeleaf.dom
Class Attribute

Object
  extended by org.thymeleaf.dom.Attribute
All Implemented Interfaces:
java.io.Serializable

public final class Attribute
extends Object
implements java.io.Serializable

Models an element attribute.

Since:
2.0.0
Author:
Daniel Fernández
See Also:
Serialized Form

Field Summary
static String XMLNS_PREFIX
           Prefix for namespace-definition attributes (like xmlns:th).
 
Constructor Summary
Attribute(String name, String value)
           
 
Method Summary
 String getNormalizedName()
           Returns the normalized name of the attribute.
 String getNormalizedPrefix()
           Returns the normalized prefix of this attribute (part of its name), if it exists, or null if the element is unprefixed.
 String getOriginalName()
           Returns the original name of the attribute.
 String getUnprefixedNormalizedName()
           Returns the normalized version of the attribute name, without its prefix (if it has one).
 String getValue()
           Returns the value of the attribute.
 String getXmlnsPrefix()
           If this is a namespace declaration attribute (like "xmlns:x"), this method returns the prefix (the "x").
 boolean hasPrefix()
           Returns whether the attribute name has a prefix or not.
 boolean isXmlnsAttribute()
           Returns whether this attribute is a namespace declaration (xmlns:*) or not.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLNS_PREFIX

public static final String XMLNS_PREFIX

Prefix for namespace-definition attributes (like xmlns:th).

See Also:
Constant Field Values
Constructor Detail

Attribute

public Attribute(String name,
                 String value)
Method Detail

getOriginalName

public String getOriginalName()

Returns the original name of the attribute. Given the fact that the engine works using the normalized versions of attribute names (in order to be case-insensitive), it is necessary to make a distinction between the 'original' name of an attribute (as it is written in the template file) and its 'normalized' name.

If the attribute name has a prefix, this 'original name' includes such prefix.

Returns:
the original name of the attribute.

getNormalizedName

public String getNormalizedName()

Returns the normalized name of the attribute. Attribute names are normalized by means of the Node.normalizeName(String) method so that the engine can work in a case-insensitive way.

If the attribute name has a prefix, this 'normalized name' includes such prefix.

Returns:
the normalized name of the attribute.

getNormalizedPrefix

public String getNormalizedPrefix()

Returns the normalized prefix of this attribute (part of its name), if it exists, or null if the element is unprefixed.

Prefixes are normalized in the same way as element names, using the Node.normalizeName(String) method.

Returns:
the normalized prefix.

getUnprefixedNormalizedName

public String getUnprefixedNormalizedName()

Returns the normalized version of the attribute name, without its prefix (if it has one).

Returns:
the unprefixed normalized name.

hasPrefix

public boolean hasPrefix()

Returns whether the attribute name has a prefix or not.

Returns:
true if the attribute name has a prefix, false if not.

getValue

public String getValue()

Returns the value of the attribute.

Returns:
the value of the attribute.

isXmlnsAttribute

public boolean isXmlnsAttribute()

Returns whether this attribute is a namespace declaration (xmlns:*) or not.

Returns:
true if the attribute is a namespace declaration, false if not.

getXmlnsPrefix

public String getXmlnsPrefix()

If this is a namespace declaration attribute (like "xmlns:x"), this method returns the prefix (the "x").

If this is not a namespace declaration attribute, this method will return null.

Returns:
the namespace prefix, if this is a namespace declaration attribute.


Copyright © 2012 The THYMELEAF team. All Rights Reserved.