xdoclet.modules.util
Class CollectionTagsHandler
java.lang.Object
xdoclet.template.TemplateTagHandler
xdoclet.XDocletTagSupport
xdoclet.modules.util.CollectionTagsHandler
public class CollectionTagsHandler
- extends XDocletTagSupport
This taghandler puts together some utility tags useful during template processing. For now, contains only a mechanism
to manage collections of strings
- Version:
- $Revision: 1.2 $
- Author:
- Marcus Brito (pazu@animegaiden.com.br)
- xdoclet.taghandler
- namespace = "Collection"
- created
- 25 Jun 2002
Method Summary |
void |
create(java.util.Properties attributes)
Creates a new utility collection that will store template data. |
void |
destroy(java.util.Properties attributes)
Destroys the specified collection. |
java.lang.String |
get(java.util.Properties attributes)
Obtains one value contained in the collection. |
void |
ifContains(java.lang.String template,
java.util.Properties attributes)
Generates the contained template code if the specified collection contains the key or value passed as attributes. |
void |
ifDoesntContain(java.lang.String template,
java.util.Properties attributes)
Generates the contained template code if the specified collection doesn't contain the key or value passed as
attributes. |
void |
put(java.util.Properties attributes)
Puts a new element into the specified collection. |
void |
remove(java.util.Properties attributes)
Removes an element from the specified collection. |
Methods inherited from class xdoclet.XDocletTagSupport |
delimit, expandClassName, generate, getCurrentClass, getCurrentClassTag, getCurrentConstructor, getCurrentField, getCurrentFieldTag, getCurrentMethod, getCurrentMethodTag, getCurrentPackage, getDocletContext, getEngine, getExpandedDelimitedTagValue, getTagValue, getTagValue, getTagValue, hasHavingClassTag, hasTag, isTagValueEqual, mandatoryParamNotFound, mandatoryTemplateTagParamNotFound, modifiers, popCurrentClass, pushCurrentClass, setCurrentClass, setCurrentClassTag, setCurrentConstructor, setCurrentField, setCurrentFieldTag, setCurrentMethod, setCurrentMethodTag, setCurrentPackage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CollectionTagsHandler
public CollectionTagsHandler()
get
public java.lang.String get(java.util.Properties attributes)
throws XDocletException
- Obtains one value contained in the collection. This tag only apply to map valued collections, and an xdoclet
exception will be throw if the specified collection is not a map.
- Parameters:
attributes
- The attributes of the template tag
- Returns:
- The requested value or null if no such value exists.
- Throws:
XDocletException
- if something goes wrong- doc.tag
- type = "content"
- doc.param
- name = "key"
optional = "false"
description = "The collection to operate on.", name = "name"
optional = "false"
description = "The key to retrive."
create
public void create(java.util.Properties attributes)
throws XDocletException
- Creates a new utility collection that will store template data. If a collection with the specified name already
exists, an XDocletException will be thrown.
- Parameters:
attributes
- The attributes of the template tag
- Throws:
XDocletException
- if something goes wrong- doc.tag
- type = "content"
- doc.param
- name = "name"
optional = "false"
description = "The name for the newly created collection", name = "type"
optional = "true"
values = "map,set"
description = "The type of the collection to
* create. Default value is set"
put
public void put(java.util.Properties attributes)
throws XDocletException
- Puts a new element into the specified collection. If the collection is a set, only the 'name' and 'value'
attributes should be specified. If the collection is a map, the 'key' value should also be specified. If the
'key' is specified and the collection is a set, or if 'key' is not specified and the collection is a map, an
XDocletException will be thrown.
- Parameters:
attributes
- The attributes of the template tag
- Throws:
XDocletException
- if something goes wrong- doc.tag
- type = "content"
- doc.param
- name = "name"
optional = "false"
description = "The name of the collection to operate on. If
* the collection does not exists, an execption will be thrown.", name = "key"
optional = "true"
description = "The key to the new value. Should only be
* specified if the collection is a map.", name = "value"
optional = "false"
description = "The value to put into the collection."
remove
public void remove(java.util.Properties attributes)
throws XDocletException
- Removes an element from the specified collection. One of 'key' or 'value' attributes should be specified,
depending if the collection is a map or a set.
- Parameters:
attributes
- The attributes of the template tag
- Throws:
XDocletException
- if something goes wrong- doc.tag
- type = "content"
- doc.param
- name = "name"
optional = "false"
description = "The name of the collection to operate on. If
* the collection does not exists, an execption will be thrown.", name = "key"
optional = "true"
description = "The key to remove from the map. Invalid if the
* collection is a set.", name = "value"
optional = "true"
description = "The value to remove from the set. Invalid if
* the collection is a map."
ifContains
public void ifContains(java.lang.String template,
java.util.Properties attributes)
throws XDocletException
- Generates the contained template code if the specified collection contains the key or value passed as attributes.
If the collection is a set, only the 'value' attribute should be specified. If the collection is a map, the 'key'
attribute should be specifed and if the 'value' attribute is also specified, an additional check for equality
will be made.
- Parameters:
template
- The block tag contentsattributes
- The attributes of the tag template
- Throws:
XDocletException
- doc.tag
- type = "block"
- doc.param
- name = "name"
optional = "false"
description = "The collection to operate on.", name = "key"
optional = "true"
description = "The key to check, if the collection is a
* map.", name = "value"
optional = "true"
description = "The valu to check, if the collection is a
* set. If the collection is a map, the value to check for equality."
ifDoesntContain
public void ifDoesntContain(java.lang.String template,
java.util.Properties attributes)
throws XDocletException
- Generates the contained template code if the specified collection doesn't contain the key or value passed as
attributes. If the collection is a set, only the 'value' attribute should be specified. If the collection is a
map, the 'key' attribute should be specifed and if the 'value' attribute is also specified, an additional check
for equality will be made.
- Parameters:
template
- The block tag contentsattributes
- The attributes of the tag template
- Throws:
XDocletException
- doc.tag
- type = "block"
- doc.param
- name = "name"
optional = "false"
description = "The collection to operate on.", name = "key"
optional = "true"
description = "The key to check, if the collection is a
* map.", name = "value"
optional = "true"
description = "The valu to check, if the collection is a
* set. If the collection is a map, the value to check for equality."
destroy
public void destroy(java.util.Properties attributes)
throws XDocletException
- Destroys the specified collection. The collection must exists or an exception will be thrown.
- Parameters:
attributes
- The attributes of the tag template
- Throws:
XDocletException
- if something goes wrong- doc.tag
- type = "content"
- doc.param
- name = "name"
description = "The collection to destroy."