Class BeanStoreTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.di.tags.BeanStoreTag
-
- All Implemented Interfaces:
org.apache.commons.jelly.Tag
public class BeanStoreTag extends org.apache.commons.jelly.TagSupport
A tag handler class for creating new
BeanStore
instances.Using this tag a hierarchy of
BeanStore
objects can be created. TheBeanTag
class allows storing the createdBeanProvider
instances in these bean stores. Using different bean stores for bean providers not only makes sense in terms of a logical grouping, but also for defining the scope of the bean providers: from a bean store all beans defined in its parent bean store can be accessed, but not vice versa. So child bean stores can be used for dealing with local bean providers that are important only for a specific module of an application, while application-global bean providers are kept in the root bean store.This tag handler class is pretty easy to use. It defines the following attributes:
Attribute Description Optional name Defines the name of the bean store. A unique name must be provided. no parentName With this attribute the name of the parent bean store can be specified. If no parent is defined, the newly created bean store will become a child of the root bean store. yes BeanStoreTag
tags can also be nested. In this case, an enclosingBeanStoreTag
will define the parent bean store of the inner tag. (If the inner tag has aparentName
attribute, the parent name defined here has priority.)- Version:
- $Id: BeanStoreTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description BeanStoreTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doTag(org.apache.commons.jelly.XMLOutput output)
The main method of this tag handler class.String
getName()
Returns the name of the bean store to be created.String
getParentName()
Returns the name of the parent bean store.BeanStoreTag
getParentStoreTag()
Returns a reference to an enclosingBeanStoreTag
, defining the parent bean store for this tag.protected void
process()
Executes this tag.void
setName(String name)
Set method of the name attribute.void
setParentName(String parentName)
Set method of the parentName attribute.protected void
setParentStoreTag(BeanStoreTag parentStoreTag)
Sets the reference to the enclosingBeanStoreTag
.-
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
-
-
-
-
Method Detail
-
getParentStoreTag
public BeanStoreTag getParentStoreTag()
Returns a reference to an enclosingBeanStoreTag
, defining the parent bean store for this tag.- Returns:
- the enclosing
BeanStoreTag
(can be null if there is none)
-
getName
public String getName()
Returns the name of the bean store to be created.- Returns:
- the name of the bean store
-
setName
public void setName(String name)
Set method of the name attribute.- Parameters:
name
- the attribute's value
-
getParentName
public String getParentName()
Returns the name of the parent bean store.- Returns:
- the name of the parent bean store
-
setParentName
public void setParentName(String parentName)
Set method of the parentName attribute.- Parameters:
parentName
- the attribute's value
-
doTag
public void doTag(org.apache.commons.jelly.XMLOutput output) throws org.apache.commons.jelly.JellyTagException
The main method of this tag handler class. Delegates to theprocess()
method for creating the bean store, then executes the tag's body.- Parameters:
output
- the output object- Throws:
org.apache.commons.jelly.JellyTagException
- if the tag is incorrectly used
-
setParentStoreTag
protected void setParentStoreTag(BeanStoreTag parentStoreTag)
Sets the reference to the enclosingBeanStoreTag
. If such a tag exists, it can be used for determining the parent bean store of the store to be created.- Parameters:
parentStoreTag
- the parent bean store tag (can be null)
-
process
protected void process() throws org.apache.commons.jelly.JellyTagException
Executes this tag. Creates the bean store if everything is okay.- Throws:
org.apache.commons.jelly.JellyTagException
- if the tag is incorrectly used
-
-