org.apache.tools.ant
Class RuntimeConfigurable
java.lang.Object
org.apache.tools.ant.RuntimeConfigurable
- Serializable
public class RuntimeConfigurable
extends java.lang.Object
implements Serializable
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.
RuntimeConfigurable(Object proxy, String elementTag) - Sole constructor creating a wrapper for the specified object.
|
void | addChild(RuntimeConfigurable child) - Adds a child element to the wrapped element.
|
void | addText(String data) - Adds characters from #PCDATA areas to the wrapped element.
|
void | addText(char[] buf, int start, int count) - Adds characters from #PCDATA areas to the wrapped element.
|
void | applyPreSet(RuntimeConfigurable r) - Apply presets, attributes and text are set if not currently set.
|
Hashtable | getAttributeMap() - Return the attribute map.
|
AttributeList | getAttributes() - Deprecated since Ant 1.6 in favor of
getAttributeMap() .
|
Enumeration | getChildren() - Returns an enumeration of all child wrappers.
|
String | getElementTag() - Returns the tag name of the wrapped element.
|
String | getPolyType() - get the polymorphic type for this element
|
Object | getProxy() - Get the object for which this RuntimeConfigurable holds the configuration
information
|
StringBuffer | getText() - Get the text content of this element.
|
void | maybeConfigure(Project p) - Configures the wrapped element and all its children.
|
void | maybeConfigure(Project p, boolean configureChildren) - Configures the wrapped element.
|
void | reconfigure(Project p) - Reconfigure the element, even if it has already been configured.
|
void | setAttribute(String name, String value) - Set an attribute to a given value
|
void | setAttributes(AttributeList attributes)
|
void | setPolyType(String polyType) - set the polymorphic type for this element
|
void | setProxy(Object proxy) - Sets the element to configure.
|
RuntimeConfigurable
public RuntimeConfigurable(Object proxy,
String elementTag)
Sole constructor creating a wrapper for the specified object.
proxy
- The element to configure. Must not be null
.elementTag
- The tag name generating this element.
Should not be null
.
addChild
public void addChild(RuntimeConfigurable child)
Adds a child element to the wrapped element.
child
- The child element wrapper to add to this one.
Must not be null
.
addText
public void addText(String data)
Adds characters from #PCDATA areas to the wrapped element.
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.
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.
applyPreSet
public void applyPreSet(RuntimeConfigurable r)
Apply presets, attributes and text are set if not currently set.
nested elements are prepended.
r
- a RuntimeConfigurable
value
getAttributeMap
public Hashtable getAttributeMap()
Return the attribute map.
- Attribute name to attribute value map
- Ant 1.6
getAttributes
public AttributeList getAttributes()
Deprecated since Ant 1.6 in favor of getAttributeMap()
.
Returns the list of attributes for the wrapped element.
- An AttributeList representing the attributes defined in the
XML for this element. May be
null
.
getChildren
public Enumeration getChildren()
Returns an enumeration of all child wrappers.
- an enumeration of the child wrappers.
- Ant 1.6
getElementTag
public String getElementTag()
Returns the tag name of the wrapped element.
- The tag name of the wrapped element. This is unlikely
to be
null
, but may be.
getPolyType
public String getPolyType()
get the polymorphic type for this element
- the ant component type name, null if not set
getProxy
public Object getProxy()
Get the object for which this RuntimeConfigurable holds the configuration
information
- the object whose configure is held by this instance.
getText
public StringBuffer getText()
Get the text content of this element. Various text chunks are
concatenated, there is no way ( currently ) of keeping track of
multiple fragments.
- the text content of this element.
- Ant 1.6
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.
p
- The project containing the wrapped element.
Must not be null
.
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.
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.
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.
reconfigure
public void reconfigure(Project p)
Reconfigure the element, even if it has already been configured.
p
- the project instance for this configuration.
setAttribute
public void setAttribute(String name,
String value)
Set an attribute to a given value
name
- the name of the attribute.value
- the attribute's value.
setAttributes
public void setAttributes(AttributeList attributes)
Sets the attributes for the wrapped element.
attributes
- List of attributes defined in the XML for this
element. May be null
.
setPolyType
public void setPolyType(String polyType)
set the polymorphic type for this element
polyType
- the ant component type name, null if not set
setProxy
public void setProxy(Object proxy)
Sets the element to configure.
proxy
- The element to configure. Must not be null
.
Copyright B) 2000-2005 Apache Software Foundation. All Rights Reserved.