Google

RuntimeConfigurable (Apache Ant API)

org.apache.tools.ant
Class RuntimeConfigurable


java.lang.Object

  |

  +--org.apache.tools.ant.RuntimeConfigurable


public class RuntimeConfigurable
extends java.lang.Object

Wrapper class that holds the attributes of an element, its children, and any text within it. It then takes care of configuring that element at runtime.

Author:
Stefan Bodewig

Constructor Summary
RuntimeConfigurable(java.lang.Object proxy, java.lang.String elementTag)
          Sole constructor creating a wrapper for the specified object.
 
          Sets the attributes for the wrapped element.
Method Summary
 void addChild(RuntimeConfigurable child)
          Adds a child element to the wrapped element.
 void addText(char[] buf, int start, int count)
          Adds characters from #PCDATA areas to the wrapped element.
 void addText(java.lang.String data)
          Adds characters from #PCDATA areas to the wrapped element.
getAttributes()
          Returns the list of attributes for the wrapped element.
 java.lang.String getElementTag()
          Returns the tag name of the wrapped element.
 void maybeConfigure(Project p)
          Configures the wrapped element and all its children.
 void maybeConfigure(Project p, boolean configureChildren)
          Configures the wrapped element.
 void
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuntimeConfigurable


public RuntimeConfigurable(java.lang.Object proxy,
                           java.lang.String elementTag)
Sole constructor creating a wrapper for the specified object.

Parameters:
proxy - The element to configure. Must not be null.
elementTag - The tag name generating this element. Should not be null.
Method Detail
setAttributes


Sets the attributes for the wrapped element.

Parameters:
attributes - List of attributes defined in the XML for this element. May be null.

getAttributes



Returns the list of attributes for the wrapped element.

Returns:
An AttributeList representing the attributes defined in the XML for this element. May be null.

addChild


public void addChild(RuntimeConfigurable child)
Adds a child element to the wrapped element.

Parameters:
child - The child element wrapper to add to this one. Must not be null.

addText


public void addText(java.lang.String data)
Adds characters from #PCDATA areas to the wrapped element.

Parameters:
data - Text to add to the wrapped element. Should not be null.

addText


public void addText(char[] buf,
                    int start,
                    int count)
Adds characters from #PCDATA areas to the wrapped element.

Parameters:
buf - A character array of the text within the element. Must not be null.
start - The start element in the array.
count - The number of characters to read from the array.

getElementTag


public java.lang.String getElementTag()
Returns the tag name of the wrapped element.

Returns:
The tag name of the wrapped element. This is unlikely to be null, but may be.

maybeConfigure


public void maybeConfigure(Project p)
                    throws BuildException
Configures the wrapped element and all its children. The attributes and text for the wrapped element are configured, and then each child is configured and added. Each time the wrapper is configured, the attributes and text for it are reset. If the element has an id attribute, a reference is added to the project as well.

Parameters:
p - The project containing the wrapped element. Must not be null.
Throws:
BuildException - if the configuration fails, for instance due to invalid attributes or children, or text being added to an element which doesn't accept it.

maybeConfigure


public void maybeConfigure(Project p,
                           boolean configureChildren)
                    throws BuildException
Configures the wrapped element. The attributes and text for the wrapped element are configured. Each time the wrapper is configured, the attributes and text for it are reset. If the element has an id attribute, a reference is added to the project as well.

Parameters:
p - The project containing the wrapped element. Must not be null.
configureChildren - Whether to configure child elements as well. if true, child elements will be configured after the wrapped element.
Throws:
BuildException - if the configuration fails, for instance due to invalid attributes or children, or text being added to an element which doesn't accept it.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.