com.conradroche.dtd.decl
Interface AttDef


public interface AttDef

Interface to hold the Attribute definition.

Author:
Conrad Roche

Field Summary
static short OPTIONALITY_DEFAULT
          Identifies a Required attribute.
static short OPTIONALITY_FIXED
          Identifies a Fixed attribute.
static short OPTIONALITY_IMPLIED
          Identifies a Implied attribute.
static short OPTIONALITY_REQUIRED
          Identifies a Required attribute.
static short TYPE_ENUM_ENUMERATION
          Identifies an Attribute defined as an Enumeration.
static short TYPE_ENUM_NOTATION
          Identifies an Attribute defined as a Notation.
static short TYPE_ENUMERATED
          Identifies an Attribute defined as a Enumerated type.
static short TYPE_NOT_TOKENIZED
          Identifies an non-Tokenized type attribute.
static short TYPE_STRING
          Identifies an Attribute defined as a String type.
static short TYPE_TOKENIZED
          Identifies an Attribute defined as a Tokenized type.
static short TYPE_TOKENIZED_ENTITIES
          Identifies the Tokenized type "ENTITIES".
static short TYPE_TOKENIZED_ENTITY
          Identifies the Tokenized type "ENTITY".
static short TYPE_TOKENIZED_ID
          Identifies the Tokenized type "ID".
static short TYPE_TOKENIZED_IDREF
          Identifies the Tokenized type "IDREF".
static short TYPE_TOKENIZED_IDREFS
          Identifies the Tokenized type "IDREFS".
static short TYPE_TOKENIZED_INVALID
          Identifies an invalid Tokenized type specification.
static short TYPE_TOKENIZED_NMTOKEN
          Identifies the Tokenized type "NMTOKEN".
static short TYPE_TOKENIZED_NMTOKENS
          Identifies the Tokenized type "NMTOKENS".
 
Method Summary
 java.lang.String getAttributeName()
          Returns the name of the attribute.
 short getAttType()
          Returns the attribute type.
 short getDefaultDeclType()
          Returns the default declartion type for this attribute.
 java.lang.String getDefaultValue()
          Returns the default value for the attribute - this will be either the default or fixed value for the attribute.
 java.util.Collection getEnumeratedValues()
          Returns the possible values defined for an Enumerated Type attribute - note that this is for both Notation as well as Enumerations.
 short getTokenizedType()
          Returns the type of the Tokenized type for this attribute; can have one of these values - TYPE_TOKENIZED_ID, TYPE_TOKENIZED_IDREF, TYPE_TOKENIZED_IDREFS, TYPE_TOKENIZED_ENTITY, TYPE_TOKENIZED_ENTITIES, TYPE_TOKENIZED_NMTOKEN or TYPE_TOKENIZED_NMTOKENS.
 boolean hasDefaultValue()
          Returns true if the attribute has a fixed or default value.
 boolean isEnumeratedType()
          Returns true if the attribute is a Enumerated type.
 boolean isEnumeration()
          Returns true if the attribute is an Enumeration.
 boolean isNotationType()
          Returns true if the attribute is of Notation type.
 boolean isStringType()
          Returns true if the attribute is a String type - i.e., the type of the attribute is declared as "CDATA".
 boolean isTokenizedType()
          Returns true if the attribute is a Tokenized type - i.e., the type of the attribute is declared as "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN" or "NMTOKENS".
 void setAttributeName(java.lang.String attName)
          Set the attribute name for this attribute definition.
 void setAttType(short attType)
          Sets the attribute type for this attribute definition.
 void setDefaultDeclType(short defDeclType)
          Set the default declaration type for this attribute definition.
 void setDefaultValue(java.lang.String defValue)
          Set the default value for the attribute definition.
 void setEnumeratedValues(java.util.Collection enumVals)
          Sets the enumerated values for this attribute definition.
 

Field Detail

TYPE_STRING

public static final short TYPE_STRING
Identifies an Attribute defined as a String type. This is identified by having a value of "CDATA" for the AttType.

TYPE_TOKENIZED

public static final short TYPE_TOKENIZED
Identifies an Attribute defined as a Tokenized type. This is identified by AttType having one of the following values - "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN" or "NMTOKENS".

TYPE_ENUMERATED

public static final short TYPE_ENUMERATED
Identifies an Attribute defined as a Enumerated type. This includes both Notations and Enumerations. This is identified by having an enumerated list of values specified for the attribute in the attribute definition.

TYPE_ENUM_ENUMERATION

public static final short TYPE_ENUM_ENUMERATION
Identifies an Attribute defined as an Enumeration.

TYPE_ENUM_NOTATION

public static final short TYPE_ENUM_NOTATION
Identifies an Attribute defined as a Notation.

TYPE_TOKENIZED_ID

public static final short TYPE_TOKENIZED_ID
Identifies the Tokenized type "ID".

TYPE_TOKENIZED_IDREF

public static final short TYPE_TOKENIZED_IDREF
Identifies the Tokenized type "IDREF".

TYPE_TOKENIZED_IDREFS

public static final short TYPE_TOKENIZED_IDREFS
Identifies the Tokenized type "IDREFS".

TYPE_TOKENIZED_ENTITY

public static final short TYPE_TOKENIZED_ENTITY
Identifies the Tokenized type "ENTITY".

TYPE_TOKENIZED_ENTITIES

public static final short TYPE_TOKENIZED_ENTITIES
Identifies the Tokenized type "ENTITIES".

TYPE_TOKENIZED_NMTOKEN

public static final short TYPE_TOKENIZED_NMTOKEN
Identifies the Tokenized type "NMTOKEN".

TYPE_TOKENIZED_NMTOKENS

public static final short TYPE_TOKENIZED_NMTOKENS
Identifies the Tokenized type "NMTOKENS".

TYPE_TOKENIZED_INVALID

public static final short TYPE_TOKENIZED_INVALID
Identifies an invalid Tokenized type specification.

TYPE_NOT_TOKENIZED

public static final short TYPE_NOT_TOKENIZED
Identifies an non-Tokenized type attribute.

OPTIONALITY_REQUIRED

public static final short OPTIONALITY_REQUIRED
Identifies a Required attribute. This is recognized in the attribute definition by the use of the "#REQUIRED" clause in the DefaultDecl section.

OPTIONALITY_IMPLIED

public static final short OPTIONALITY_IMPLIED
Identifies a Implied attribute. This is recognized in the attribute definition by the use of the "#IMPLIED" clause in the DefaultDecl section.

OPTIONALITY_FIXED

public static final short OPTIONALITY_FIXED
Identifies a Fixed attribute. This is recognized in the attribute definition by the use of the "#FIXED" clause in the DefaultDecl section.

OPTIONALITY_DEFAULT

public static final short OPTIONALITY_DEFAULT
Identifies a Required attribute. This is recognized in the attribute definition by the use of non of the clauses in the DefaultDecl section, other than the default value.
Method Detail

getAttributeName

public java.lang.String getAttributeName()
Returns the name of the attribute.
Returns:
The Attribute name.

setAttributeName

public void setAttributeName(java.lang.String attName)
Set the attribute name for this attribute definition.
Parameters:
attName - The attribute name.

getAttType

public short getAttType()
Returns the attribute type. Can have one of three values - TYPE_STRING, TYPE_TOKENIZED or TYPE_ENUMERATED.
Returns:
The attribute type.

setAttType

public void setAttType(short attType)
Sets the attribute type for this attribute definition. It can have one of the following values - TYPE_STRING, TYPE_ENUM_ENUMERATION, TYPE_ENUM_NOTATION, TYPE_TOKENIZED_ID, TYPE_TOKENIZED_IDREF, TYPE_TOKENIZED_IDREFS, TYPE_TOKENIZED_ENTITY, TYPE_TOKENIZED_ENTITIES, TYPE_TOKENIZED_NMTOKEN or TYPE_TOKENIZED_NMTOKENS.
Parameters:
attType - The attribute type.

isStringType

public boolean isStringType()
Returns true if the attribute is a String type - i.e., the type of the attribute is declared as "CDATA".
Returns:
true if the attribute is a String type; false otherwise.

isTokenizedType

public boolean isTokenizedType()
Returns true if the attribute is a Tokenized type - i.e., the type of the attribute is declared as "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN" or "NMTOKENS".
Returns:
true if the attribute is a Tokenized type; false otherwise.

isEnumeratedType

public boolean isEnumeratedType()
Returns true if the attribute is a Enumerated type. From the XML Specifications - [Definition: Enumerated attributes can take one of a list of values provided in the declaration].
Returns:
true if the attribute is a Enumerated type; false otherwise.

getTokenizedType

public short getTokenizedType()
Returns the type of the Tokenized type for this attribute; can have one of these values - TYPE_TOKENIZED_ID, TYPE_TOKENIZED_IDREF, TYPE_TOKENIZED_IDREFS, TYPE_TOKENIZED_ENTITY, TYPE_TOKENIZED_ENTITIES, TYPE_TOKENIZED_NMTOKEN or TYPE_TOKENIZED_NMTOKENS.
Returns:
The type of the Tokenized attribute.

isNotationType

public boolean isNotationType()
Returns true if the attribute is of Notation type.
Returns:
true if the attribute is a Notation type; false otherwise.

isEnumeration

public boolean isEnumeration()
Returns true if the attribute is an Enumeration.
Returns:
true if the attribute is an Enumeration; false otherwise.

getEnumeratedValues

public java.util.Collection getEnumeratedValues()
Returns the possible values defined for an Enumerated Type attribute - note that this is for both Notation as well as Enumerations.
Returns:
This list of possible values. A Collection of String objects.

setEnumeratedValues

public void setEnumeratedValues(java.util.Collection enumVals)
Sets the enumerated values for this attribute definition.
Parameters:
enumVals - The enumerated values as a Collection of String objects.

getDefaultDeclType

public short getDefaultDeclType()
Returns the default declartion type for this attribute. Can have one of these values - OPTIONALITY_REQUIRED, OPTIONALITY_IMPLIED, OPTIONALITY_FIXED or OPTIONALITY_DEFAULT.
Returns:
The default declaration type.

setDefaultDeclType

public void setDefaultDeclType(short defDeclType)
Set the default declaration type for this attribute definition.
Parameters:
defDeclType - The default declaration type.

hasDefaultValue

public boolean hasDefaultValue()
Returns true if the attribute has a fixed or default value.
Returns:
true if the attribute has a fixed or default value; false otherwise.

getDefaultValue

public java.lang.String getDefaultValue()
Returns the default value for the attribute - this will be either the default or fixed value for the attribute. //CR: TODO: What to do if the default value has some entity reference.
Returns:
The default value of the attribute.

setDefaultValue

public void setDefaultValue(java.lang.String defValue)
Set the default value for the attribute definition.
Parameters:
defValue - The default value.