org.apache.myfaces.buildtools.maven2.plugin.builder.model
Class TagMeta

java.lang.Object
  extended by org.apache.myfaces.buildtools.maven2.plugin.builder.model.ClassMeta
      extended by org.apache.myfaces.buildtools.maven2.plugin.builder.model.TagMeta
All Implemented Interfaces:
AttributeHolder

public class TagMeta
extends ClassMeta
implements AttributeHolder

Represents metadata about a class that is just a pure JSF Tag class, with no corresponding JSF component, validator or converter.

There are not very many pure tag classes, but there are a few. One example is the f:attribute tag from the JSF core specification, which exists solely to store an entry into the attributes map of some other component when the view is first created.

Another example is the f:converter tag, which creates a corresponding converter component by id, and stores it into the view. The tag doesn't correspond to any particular converter class, so there is no converter class whose annotations can be used to describe this generic tag. Note that specific converters can also have their own dedicated tags (eg f:convertDateTime) in which case the TLD entry is generated using metadata from the converter class.

Another case when this is needed is where there are multiple tags that correspond to a single component class. For example, in the core implementation both f:outputText and f:verbatim are implemented with the UIOutputText component. In this case, the component is used to generate one TLD entry (the "primary" tag) but TLD entries for the "secondary" tag must be triggered in another way.

In the above cases, the tag class itself can be annotated with this annotation. During TLD file generation, an appropriate entry is then added.

An alternative is to omit this entry, and simply write the TLD entries for these few classes by hand in the "base" file that gets included into the generated one.


Field Summary
protected  Map _attributes
           
 
Constructor Summary
TagMeta()
          Constructor.
 
Method Summary
 void addAttribute(AttributeMeta attribute)
          Adds a property to this component.
static void addXmlRules(org.apache.commons.digester.Digester digester, String prefix)
          Add digester rules to repopulate an instance of this type from an xml file.
 Iterator attributes()
          Returns an iterator for all properties
 int attributesSize()
          Number of properties for this component
 AttributeMeta getAttribute(String attributeName)
           
 Collection getAttributeList()
           
 String getBodyContent()
           
 String getDescription()
           
 String getLongDescription()
           
 String getName()
           
 String getTagHandler()
           
 boolean hasAttributes()
          Returns true if this component has any properties.
 void merge(TagMeta other)
          Merge the data in the specified other property into this one, throwing an exception if there is an incompatibility.
 void setBodyContent(String bodyContent)
           
 void setDescription(String description)
          Sets the brief description of this property.
 void setLongDescription(String longDescription)
          Sets the long description of this property.
 void setName(String name)
          Sets the name that the user will refer to instances of this component by.
 void setTagHandler(String tagHandler)
          Specifies the class of the Facelets tag handler (component handler) for this component.
protected  void writeXmlSimple(XmlWriter out)
          Write an instance of this class out as xml.
 
Methods inherited from class org.apache.myfaces.buildtools.maven2.plugin.builder.model.ClassMeta
addInterfaceClassName, getClassName, getInterfaceClassNames, getModelId, getPackageName, getParentClassName, getSourceClassName, getSourceClassParentClassName, merge, setClassName, setInterfaceClassNames, setModelId, setParentClassName, setSourceClassName, setSourceClassParentClassName, writeXml, writeXmlComplex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_attributes

protected Map _attributes
Constructor Detail

TagMeta

public TagMeta()
Constructor.

Method Detail

writeXmlSimple

protected void writeXmlSimple(XmlWriter out)
Write an instance of this class out as xml.

Overrides:
writeXmlSimple in class ClassMeta

addXmlRules

public static void addXmlRules(org.apache.commons.digester.Digester digester,
                               String prefix)
Add digester rules to repopulate an instance of this type from an xml file.


merge

public void merge(TagMeta other)
Merge the data in the specified other property into this one, throwing an exception if there is an incompatibility.


setDescription

public void setDescription(String description)
Sets the brief description of this property.

This description is used in tooltips, etc.


getDescription

public String getDescription()

setLongDescription

public void setLongDescription(String longDescription)
Sets the long description of this property.


getLongDescription

public String getLongDescription()

setBodyContent

public void setBodyContent(String bodyContent)

getBodyContent

public String getBodyContent()

setName

public void setName(String name)
Sets the name that the user will refer to instances of this component by.

In JSP tags, this value will be used as the JSP tag name.

This property is optional; if not set then this Model instance represents a base class that components can be derived from, but which cannot itself be instantiated as a component.


getName

public String getName()

setTagHandler

public void setTagHandler(String tagHandler)
Specifies the class of the Facelets tag handler (component handler) for this component.

Note that a Facelets tag handler class is not needed for most components.


getTagHandler

public String getTagHandler()

addAttribute

public void addAttribute(AttributeMeta attribute)
Adds a property to this component.

Specified by:
addAttribute in interface AttributeHolder

getAttribute

public AttributeMeta getAttribute(String attributeName)
Specified by:
getAttribute in interface AttributeHolder

attributesSize

public int attributesSize()
Number of properties for this component


hasAttributes

public boolean hasAttributes()
Returns true if this component has any properties.


attributes

public Iterator attributes()
Returns an iterator for all properties

Specified by:
attributes in interface AttributeHolder

getAttributeList

public Collection getAttributeList()


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.