net.sf.jguiraffe.gui.builder.di.tags
Class AbstractBeanTag

java.lang.Object
  extended by org.apache.commons.jelly.TagSupport
      extended by net.sf.jguiraffe.gui.builder.di.tags.AbstractBeanTag
All Implemented Interfaces:
org.apache.commons.jelly.Tag
Direct Known Subclasses:
BeanTag, CollectionTag, MapTag

public abstract class AbstractBeanTag
extends org.apache.commons.jelly.TagSupport

An abstract base class for tag handler implementations that create bean providers.

This class provides some common functionality related to the creation and management of BeanProvider objects. The features implemented here include the following:

Version:
$Id: AbstractBeanTag.java 156 2009-03-03 21:04:47Z oheger $
Author:
Oliver Heger

Field Summary
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
AbstractBeanTag()
           
 
Method Summary
protected abstract  BeanProvider createBeanProvider()
          Creates the bean provider defined by this tag.
 void doTag(org.apache.commons.jelly.XMLOutput output)
          The main method of this tag.
 BeanStoreTag getBeanStoreTag()
          Returns a reference to the enclosing BeanStoreTag.
 java.lang.String getName()
          Returns the name of the managed bean definition.
 java.lang.String getStore()
          Returns the name of the BeanStore, in which to place the managed bean definition.
 DependencyTag getTargetDependency()
          Returns the target dependency.
 boolean isAnonymous()
          Returns a flag whether this tag declares an anonymous bean.
protected  void process()
          Processes this tag after its body has been evaluated.
protected  void processBeforeBody()
          Performs pre-processing before the body of this tag is evaluated.
protected  void setBeanStoreTag(BeanStoreTag beanStoreTag)
          Sets the reference to the enclosing BeanStoreTag.
 void setStore(java.lang.String store)
          Set method of the store attribute.
protected  void store(BeanProvider provider)
          Stores the newly created BeanProvider in the correct bean store.
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBeanTag

public AbstractBeanTag()
Method Detail

getName

public java.lang.String getName()
Returns the name of the managed bean definition. This name is used when the BeanProvider created by this tag is stored in a BeanStore. In this base implementation the name is only queried to distinguish whether this is a normal or an anonymous bean definition. getName() always returns null here; if derived classes support setting a name, they must override this method.

Returns:
the name of the bean definition

getStore

public java.lang.String getStore()
Returns the name of the BeanStore, in which to place the managed bean definition.

Returns:
the name of the bean store

setStore

public void setStore(java.lang.String store)
Set method of the store attribute.

Parameters:
store - the attribute's value

getBeanStoreTag

public BeanStoreTag getBeanStoreTag()
Returns a reference to the enclosing BeanStoreTag. This can be null if there is no such tag.

Returns:
a reference to the enclosing bean store tag

getTargetDependency

public DependencyTag getTargetDependency()
Returns the target dependency. If this is a valid anonymous bean declaration, there is a target dependency tag, on which to set the reference to the declared bean.

Returns:
the target dependency tag

isAnonymous

public boolean isAnonymous()
Returns a flag whether this tag declares an anonymous bean. This is a bean without a name that is only visible in the context it is declared.

Returns:
a flag if this is an anonymous bean

doTag

public void doTag(org.apache.commons.jelly.XMLOutput output)
           throws org.apache.commons.jelly.JellyTagException
The main method of this tag. Delegates to the specific processing methods.

Parameters:
output - the output object
Throws:
org.apache.commons.jelly.JellyTagException - if an error occurs or the tag is incorrectly used

setBeanStoreTag

protected void setBeanStoreTag(BeanStoreTag beanStoreTag)
Sets the reference to the enclosing BeanStoreTag. This can be null if this tag is not placed in the body of a bean store tag.

Parameters:
beanStoreTag - the enclosing BeanStoreTag

processBeforeBody

protected void processBeforeBody()
                          throws org.apache.commons.jelly.JellyTagException
Performs pre-processing before the body of this tag is evaluated. This method is called by the doTag() method. It checks whether this tag is nested inside a DependencyTag, which will become the target dependency, i.e. if this is an anonymous bean declaration, the target dependency will be initialized to point to this bean.

Throws:
org.apache.commons.jelly.JellyTagException - if no name is defined for this tag, but no target dependency can be obtained or the target dependency is already initialized

process

protected void process()
                throws org.apache.commons.jelly.JellyTagException
Processes this tag after its body has been evaluated. Creates the bean provider and adds it to the correct bean store.

Throws:
org.apache.commons.jelly.JellyTagException - if the tag is incorrectly used

store

protected void store(BeanProvider provider)
              throws org.apache.commons.jelly.JellyTagException
Stores the newly created BeanProvider in the correct bean store. This method is called by process() when a provider could be successfully created.

Parameters:
provider - the newly created bean provider
Throws:
org.apache.commons.jelly.JellyTagException - if an error occurs

createBeanProvider

protected abstract BeanProvider createBeanProvider()
                                            throws org.apache.commons.jelly.JellyTagException
Creates the bean provider defined by this tag. This method is invoked by process(). A concrete subclass has to implement it and return a BeanProvider, which will be stored in the selected bean store.

Returns:
the bean provider defined by this tag
Throws:
org.apache.commons.jelly.JellyTagException - in case of an error


Copyright © 2009 The JGUIraffe Team. All Rights Reserved.