xdoclet.modules.util
Class CollectionTagsHandler
java.lang.Object
xdoclet.template.TemplateTagHandler
xdoclet.XDocletTagSupport
xdoclet.modules.util.CollectionTagsHandler
public class CollectionTagsHandler
extends xdoclet.XDocletTagSupport
This taghandler puts together some utility tags useful during template processing. For now, contains only a mechanism
to manage collections of strings
- Marcus Brito (pazu@animegaiden.com.br)
void | create(Properties attributes) - Creates a new utility collection that will store template data.
|
void | destroy(Properties attributes) - Destroys the specified collection.
|
String | get(Properties attributes) - Obtains one value contained in the collection.
|
void | ifContains(String template, Properties attributes) - Generates the contained template code if the specified collection contains the key or value passed as attributes.
|
void | ifDoesntContain(String template, Properties attributes) - Generates the contained template code if the specified collection doesn't contain the key or value passed as
attributes.
|
void | put(Properties attributes) - Puts a new element into the specified collection.
|
void | remove(Properties attributes) - Removes an element from the specified collection.
|
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 |
create
public void create(Properties attributes)
throws xdoclet.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.
attributes
- The attributes of the template tag
xdoclet.XDocletException
- if something goes wrong
- 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"
destroy
public void destroy(Properties attributes)
throws xdoclet.XDocletException
Destroys the specified collection. The collection must exists or an exception will be thrown.
attributes
- The attributes of the tag template
xdoclet.XDocletException
- if something goes wrong
- name = "name"
description = "The collection to destroy."
get
public String get(Properties attributes)
throws xdoclet.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.
attributes
- The attributes of the template tag
- The requested value or null if no such value exists.
xdoclet.XDocletException
- if something goes wrong
- name = "key"
optional = "false"
description = "The collection to operate on."
- name = "name"
optional = "false"
description = "The key to retrive."
ifContains
public void ifContains(String template,
Properties attributes)
throws xdoclet.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.
template
- The block tag contentsattributes
- The attributes of the tag template
xdoclet.XDocletException
-
- 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(String template,
Properties attributes)
throws xdoclet.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.
template
- The block tag contentsattributes
- The attributes of the tag template
xdoclet.XDocletException
-
- 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."
put
public void put(Properties attributes)
throws xdoclet.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.
attributes
- The attributes of the template tag
xdoclet.XDocletException
- if something goes wrong
- 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(Properties attributes)
throws xdoclet.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.
attributes
- The attributes of the template tag
xdoclet.XDocletException
- if something goes wrong
- 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."