FileDocCategorySizeDatePackage
TagData.javaAPI DocGlassfish v2 API5781Fri May 04 22:34:28 BST 2007javax.servlet.jsp.tagext

TagData

public class TagData extends Object implements Cloneable
The (translation-time only) attribute/value information for a tag instance.

TagData is only used as an argument to the isValid, validate, and getVariableInfo methods of TagExtraInfo, which are invoked at translation time.

Fields Summary
public static final Object
REQUEST_TIME_VALUE
Distinguished value for an attribute to indicate its value is a request-time expression (which is not yet available because TagData instances are used at translation-time).
private Hashtable
attributes
Constructors Summary
public TagData(Object[] atts)
Constructor for TagData.

A typical constructor may be

static final Object[][] att = {{"connection", "conn0"}, {"id", "query0"}};
static final TagData td = new TagData(att);
All values must be Strings except for those holding the distinguished object REQUEST_TIME_VALUE.

param
atts the static attribute and values. May be null.



                                                            
       
	if (atts == null) {
	    attributes = new Hashtable<String, Object>();
	} else {
	    attributes = new Hashtable<String, Object>(atts.length);
	}

	if (atts != null) {
	    for (int i = 0; i < atts.length; i++) {
		attributes.put((String)atts[i][0], atts[i][1]);
	    }
	}
    
public TagData(Hashtable attrs)
Constructor for a TagData. If you already have the attributes in a hashtable, use this constructor.

param
attrs A hashtable to get the values from.

        this.attributes = attrs;
    
Methods Summary
public java.lang.ObjectgetAttribute(java.lang.String attName)
The value of the attribute. If a static value is specified for an attribute that accepts a request-time attribute expression then that static value is returned, even if the value is provided in the body of a <jsp:attribute> action. The distinguished object REQUEST_TIME_VALUE is only returned if the value is specified as a request-time attribute expression or via the <jsp:attribute> action with a body that contains dynamic content (scriptlets, scripting expressions, EL expressions, standard actions, or custom actions). Returns null if the attribute is not set.

param
attName the name of the attribute
return
the attribute's value

	return attributes.get(attName);
    
public java.lang.StringgetAttributeString(java.lang.String attName)
Get the value for a given attribute.

param
attName the name of the attribute
return
the attribute value string
throws
ClassCastException if attribute value is not a String

	Object o = attributes.get(attName);
	if (o == null) {
	    return null;
	} else {
	    return (String) o;
	}	
    
public java.util.EnumerationgetAttributes()
Enumerates the attributes.

return
An enumeration of the attributes in a TagData

        return attributes.keys();
    
public java.lang.StringgetId()
The value of the tag's id attribute.

return
the value of the tag's id attribute, or null if no such attribute was specified.

	return getAttributeString(TagAttributeInfo.ID);
    
public voidsetAttribute(java.lang.String attName, java.lang.Object value)
Set the value of an attribute.

param
attName the name of the attribute
param
value the value.

	attributes.put(attName, value);