com.plumtree.portaluiinfrastructure.tags.metadata
Class RequiredTagAttribute

java.lang.Object
  extended by com.plumtree.portaluiinfrastructure.tags.metadata.ATagAttribute
      extended by com.plumtree.portaluiinfrastructure.tags.metadata.RequiredTagAttribute

public class RequiredTagAttribute
extends ATagAttribute

This class provides programmatic access to the tag meta data for required attributes, including name, description, and type.

Tag classes need to have one public static final RequiredTagAttribute member variable for every attribute that this tag requires.

E.G.
<pt:thistag pt:firstattribute="foo" pt:secondattribute="bar"/>
would need
public static final RequiredTagAttribute = new RequiredTagAttribute( "firstattribute", "This attribute is used to ...");
public static final RequiredTagAttribute = new RequiredTagAttribute( "secondattribute", "This attribute is used to ...");

The RequiredTagAttribute objects are used for programmatic access to tag meta data, as well as to pre-process tags for required attributes (presence and correct type). If the attributes are not correct (missing required attribute or bad value), an error will be logged and the tag and its children will be skipped and not displayed. An HTML Comment describing the tag and error will be displayed instead.

See Also:
OptionalTagAttribute

Field Summary
 
Fields inherited from class com.plumtree.portaluiinfrastructure.tags.metadata.ATagAttribute
m_strDescription, m_strName, m_Type
 
Constructor Summary
RequiredTagAttribute(java.lang.String _strName, java.lang.String _strDescription)
          Creates a new required tag attribute of type String.
RequiredTagAttribute(java.lang.String _strName, java.lang.String _strDescription, AttributeType _type)
          Creates a new required tag attribute.
 
Method Summary
 void CheckValue(java.lang.String _strValue)
          This method is used to ensure that the input supplied for this attribute is valid.
 java.lang.String GetDefaultValue()
          The default value for an optional attribute if the attribute is not present or is of the incorrect type.
 boolean GetIsRequired()
          Gets whether or not this attribute is required to be present every time the tag is used.
 
Methods inherited from class com.plumtree.portaluiinfrastructure.tags.metadata.ATagAttribute
CheckNameSafety, GetDescription, GetName, GetType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequiredTagAttribute

public RequiredTagAttribute(java.lang.String _strName,
                            java.lang.String _strDescription)
Creates a new required tag attribute of type String.

If a required attribute is missing from a tag, the tag will fail.

Parameters:
_strName - The attribute name
_strDescription - The attribute description
Throws:
XPFormatException - if the name contains any whitespace.

RequiredTagAttribute

public RequiredTagAttribute(java.lang.String _strName,
                            java.lang.String _strDescription,
                            AttributeType _type)
Creates a new required tag attribute.

If a required attribute is missing from a tag, the tag will fail.

Parameters:
_strName - The attribute name
_strDescription - The attribute description
_type - The attribute type
Throws:
XPFormatException - if the name contains any whitespace.
XPIllegalArgumentException - if the AttributeType is null.
Method Detail

GetIsRequired

public boolean GetIsRequired()
Description copied from class: ATagAttribute
Gets whether or not this attribute is required to be present every time the tag is used. If it is required, the tag will fail if it is not present.

Specified by:
GetIsRequired in class ATagAttribute
Returns:
boolean True means that this attribute is required
See Also:
com.plumtree.portaluiinfrastructure.tags.metadat.ATagAttribute#GetIsRequired()

GetDefaultValue

public java.lang.String GetDefaultValue()
Description copied from class: ATagAttribute
The default value for an optional attribute if the attribute is not present or is of the incorrect type. This will return null for required attributes.

Specified by:
GetDefaultValue in class ATagAttribute
Returns:
String The default value for this attribute. Null implies there is no default value.
See Also:
com.plumtree.portaluiinfrastructure.tags.metadat.ATagAttribute#GetDefaultValue()

CheckValue

public void CheckValue(java.lang.String _strValue)
This method is used to ensure that the input supplied for this attribute is valid.

Parameters:
String - _strValue The supplied input value.
Throws:
XPFormatException - The input cannot be converted to the appropriate type.



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.