JDOM
0.0.5-BETA

org.jdom2
Enum AttributeType

java.lang.Object
  extended by java.lang.Enum<AttributeType>
      extended by org.jdom2.AttributeType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<AttributeType>

public enum AttributeType
extends java.lang.Enum<AttributeType>

Use a simple enumeration for the Attribute Types

Author:
Rolf Lear

Enum Constant Summary
CDATA
          Attribute type: the attribute value is a string.
ENTITIES
           Attribute type: the attribute value is a list of entity names.
ENTITY
          Attribute type: the attribute value is the name of an entity.
ENUMERATION
          Attribute type: the attribute value is a name token from an enumeration.
ID
          Attribute type: the attribute value is a unique identifier.
IDREF
          Attribute type: the attribute value is a reference to a unique identifier.
IDREFS
          Attribute type: the attribute value is a list of references to unique identifiers.
NMTOKEN
          Attribute type: the attribute value is a name token.
NMTOKENS
          Attribute type: the attribute value is a list of name tokens.
NOTATION
          Attribute type: the attribute value is the name of a notation.
UNDECLARED
          Attribute type: the attribute has not been declared or type is unknown.
 
Method Summary
static AttributeType byIndex(int index)
          Deprecated. Use normal Enums instead of int's
static AttributeType getAttributeType(java.lang.String typeName)
          Returns the the JDOM AttributeType value from the SAX 2.0 attribute type string provided by the parser.
static AttributeType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static AttributeType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

UNDECLARED

public static final AttributeType UNDECLARED
Attribute type: the attribute has not been declared or type is unknown.

See Also:
getAttributeType(java.lang.String)

CDATA

public static final AttributeType CDATA
Attribute type: the attribute value is a string.

See Also:
Attribute.getAttributeType()

ID

public static final AttributeType ID
Attribute type: the attribute value is a unique identifier.

See Also:
getAttributeType(java.lang.String)

IDREF

public static final AttributeType IDREF
Attribute type: the attribute value is a reference to a unique identifier.

See Also:
getAttributeType(java.lang.String)

IDREFS

public static final AttributeType IDREFS
Attribute type: the attribute value is a list of references to unique identifiers.

See Also:
getAttributeType(java.lang.String)

ENTITY

public static final AttributeType ENTITY
Attribute type: the attribute value is the name of an entity.

See Also:
getAttributeType(java.lang.String)

ENTITIES

public static final AttributeType ENTITIES

Attribute type: the attribute value is a list of entity names.

See Also:
getAttributeType(java.lang.String)

NMTOKEN

public static final AttributeType NMTOKEN
Attribute type: the attribute value is a name token.

According to SAX 2.0 specification, attributes of enumerated types should be reported as "NMTOKEN" by SAX parsers. But the major parsers (Xerces and Crimson) provide specific values that permit to recognize them as ENUMERATION.

See Also:
Attribute.getAttributeType()

NMTOKENS

public static final AttributeType NMTOKENS
Attribute type: the attribute value is a list of name tokens.

See Also:
getAttributeType(java.lang.String)

NOTATION

public static final AttributeType NOTATION
Attribute type: the attribute value is the name of a notation.

See Also:
getAttributeType(java.lang.String)

ENUMERATION

public static final AttributeType ENUMERATION
Attribute type: the attribute value is a name token from an enumeration.

See Also:
getAttributeType(java.lang.String)
Method Detail

values

public static AttributeType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (AttributeType c : AttributeType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static AttributeType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

byIndex

@Deprecated
public static final AttributeType byIndex(int index)
Deprecated. Use normal Enums instead of int's

Obtain a AttributeType by a int constant. This goes against the logic of enums, but this is used for backward compatibility. Thus, this method is marked Deprecated.

Parameters:
index - The AttributeType int equivalent to retrieve
Returns:
The AttributeType corresponding to the specified equivalent
Throws:
java.lang.IllegalArgumentException - if there is no equivalent

getAttributeType

public static final AttributeType getAttributeType(java.lang.String typeName)
Returns the the JDOM AttributeType value from the SAX 2.0 attribute type string provided by the parser.

Parameters:
typeName - String the SAX 2.0 attribute type string.
Returns:
int the JDOM attribute type.
See Also:
Attribute.setAttributeType(org.jdom2.AttributeType), Attributes.getType(int)

JDOM
0.0.5-BETA

Copyright � 2012 Jason Hunter, Brett McLaughlin. All Rights Reserved.