Top Description Inners Fields Constructors Methods
org.apache.tools.ant

public Class RuntimeConfigurable

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, java.util.ArrayList, .Collections, .Enumeration, .Hashtable, .LinkedHashMap, .List, .Map, org.apache.tools.ant.attribute.EnableAttribute, org.apache.tools.ant.taskdefs.MacroDef.Attribute, .MacroInstance, org.xml.sax.AttributeList, org.xml.sax.helpers.AttributeListImpl

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
RuntimeConfigurable.AttributeComponentInformation

contains the attribute component name and boolean restricted set to true when the attribute is in one of the name spaces managed by ant (if and unless currently)

private static class

Field Summary

Modifier and TypeField and Description
private LinkedHashMap<String, Object>
attributeMap

Attribute names and values.

private transient AttributeList
attributes

XML attributes for the element.

private StringBuffer
characters

Text appearing within the element.

private List<RuntimeConfigurable>
children

List of child element wrappers.

private String
elementTag

Name of the element to configure.

private String
id

the "id" of this Element if it has one

private transient boolean
private String
polyType

the polymorphic type

private boolean
proxyConfigured

Indicates if the wrapped object has been configured

private static final long
serialVersionUID

Serialization version

private transient Object
wrappedObject

The element to configure.

Constructor Summary

AccessConstructor and Description
public
RuntimeConfigurable(Object
The element to configure. Must not be null.
proxy
,
String
The tag name generating this element.
elementTag
)

Sole constructor creating a wrapper for the specified object.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addChild(RuntimeConfigurable
The child element wrapper to add to this one. Must not be null.
child
)

Adds a child element to the wrapped element.

public synchronized void
addText(String
Text to add to the wrapped element. Should not be null.
data
)

Adds characters from #PCDATA areas to the wrapped element.

public synchronized void
addText(char[]
A character array of the text within the element. Must not be null.
buf
,
int
The start element in the array.
start
,
int
The number of characters to read from the array.
count
)

Adds characters from #PCDATA areas to the wrapped element.

public void
applyPreSet(RuntimeConfigurable
a RuntimeConfigurable value.
r
)

Apply presets, attributes and text are set if not currently set.

private String
public synchronized Hashtable<String, Object>

Returns:

Attribute name to attribute value map.
getAttributeMap
()

Return the attribute map.

public synchronized AttributeList

Returns:

An AttributeList representing the attributes defined in the XML for this element. May be null.
getAttributes
()

Deprecated Deprecated since Ant 1.6 in favor of getAttributeMap.
Returns the list of attributes for the wrapped element.
pack-priv synchronized RuntimeConfigurable

Returns:

The child wrapper at position index within the list.
getChild
(int
The index of the child to return.
index
)

Returns the child wrapper at the specified position within the list.

public synchronized Enumeration<RuntimeConfigurable>

Returns:

an enumeration of the child wrappers.
getChildren
()

Returns an enumeration of all child wrappers.

public synchronized String

Returns:

The tag name of the wrapped element. This is unlikely to be null, but may be.
getElementTag
()

Returns the tag name of the wrapped element.

public synchronized String

Returns:

the id.
getId
()

Returns the id for this element.

public synchronized String

Returns:

the ant component type name, null if not set.
getPolyType
()

Get the polymorphic type for this element.

public synchronized Object

Returns:

the object whose configure is held by this instance.
getProxy
()

Get the object for which this RuntimeConfigurable holds the configuration information.

public synchronized StringBuffer

Returns:

the text content of this element.
getText
()

Get the text content of this element.

public boolean

Returns:

true if enabled, false if any of the ant attributes return false.
isEnabled
(UnknownElement
the UE that owns this RC.
owner
)

Check if an UE is enabled.

private RuntimeConfigurable.AttributeComponentInformation

Returns:

AttributeComponentInformation instance
isRestrictedAttribute
(String
the name of the attribute.
name
,
ComponentHelper
current component helper
componentHelper
)

public void
maybeConfigure(Project
The project containing the wrapped element. Must not be null.
p
)

Configures the wrapped element and all its children.

public synchronized void
maybeConfigure(Project
The project containing the wrapped element. Must not be null.
p
,
boolean
ignored.
configureChildren
)

Configures the wrapped element.

public void
reconfigure(Project
the project instance for this configuration.
p
)

Reconfigure the element, even if it has already been configured.

public synchronized void
removeAttribute(String
the name of the attribute to be removed.
name
)

Delete an attribute.

public synchronized void
setAttribute(String
the name of the attribute.
name
,
String
the attribute's value.
value
)

Set an attribute to a given value.

public synchronized void
setAttribute(String
the name of the attribute.
name
,
Object
the attribute's value.
value
)

Set an attribute to a given value.

public synchronized void
setAttributes(AttributeList
List of attributes defined in the XML for this element. May be null.
attributes
)

Deprecated since 1.6.x.
Sets the attributes for the wrapped element.
pack-priv synchronized void
setCreator(IntrospectionHelper.Creator
the creator object.
creator
)

Sets the creator of the element to be configured used to store the element in the parent.

public synchronized void
setElementTag(String
The tag name generating this element.
elementTag
)

Set the element tag.

public synchronized void
setPolyType(String
the ant component type name, null if not set.
polyType
)

Set the polymorphic type for this element.

public synchronized void
setProxy(Object
The element to configure. Must not be null.
proxy
)

Sets the element to configure.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeMapback to summary
private LinkedHashMap<String, Object> attributeMap

Attribute names and values. While the XML spec doesn't require preserving the order (AFAIK), some ant tests do rely on the exact order. The only exception to this order is the treatment of refid. A number of datatypes check if refid is set when other attributes are set. This check will not work if the build script has the other attribute before the "refid" attribute, so now (ANT 1.7) the refid attribute will be processed first.

attributesback to summary
private transient AttributeList attributes

Deprecated

since 1.6.x

XML attributes for the element.

Annotations
@Deprecated
charactersback to summary
private StringBuffer characters

Text appearing within the element.

childrenback to summary
private List<RuntimeConfigurable> children

List of child element wrappers.

elementTagback to summary
private String elementTag

Name of the element to configure.

idback to summary
private String id

the "id" of this Element if it has one

namespacedAttributeback to summary
private transient boolean namespacedAttribute
polyTypeback to summary
private String polyType

the polymorphic type

proxyConfiguredback to summary
private boolean proxyConfigured

Indicates if the wrapped object has been configured

serialVersionUIDback to summary
private static final long serialVersionUID

Serialization version

wrappedObjectback to summary
private transient Object wrappedObject

The element to configure. It is only used during maybeConfigure.

Constructor Detail

RuntimeConfigurableback to summary
public RuntimeConfigurable(Object proxy, String elementTag)

Sole constructor creating a wrapper for the specified object.

Parameters
proxy:Object

The element to configure. Must not be null.

elementTag:String

The tag name generating this element.

Method Detail

addChildback to summary
public synchronized void addChild(RuntimeConfigurable child)

Adds a child element to the wrapped element.

Parameters
child:RuntimeConfigurable

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

addTextback to summary
public synchronized void addText(String data)

Adds characters from #PCDATA areas to the wrapped element.

Parameters
data:String

Text to add to the wrapped element. Should not be null.

addTextback to summary
public synchronized void addText(char[] buf, int start, int count)

Adds characters from #PCDATA areas to the wrapped element.

Parameters
buf:char[]

A character array of the text within the element. Must not be null.

start:int

The start element in the array.

count:int

The number of characters to read from the array.

applyPreSetback to summary
public void applyPreSet(RuntimeConfigurable r)

Apply presets, attributes and text are set if not currently set. Nested elements are prepended.

Parameters
r:RuntimeConfigurable

a RuntimeConfigurable value.

attrToComponentback to summary
private String attrToComponent(String a)
getAttributeMapback to summary
public synchronized Hashtable<String, Object> getAttributeMap()

Return the attribute map.

Returns:Hashtable<String, Object>

Attribute name to attribute value map.

Since
Ant 1.6
getAttributesback to summary
public synchronized AttributeList getAttributes()

Deprecated

Deprecated since Ant 1.6 in favor of getAttributeMap.

Returns the list of attributes for the wrapped element.

Returns:AttributeList

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

Annotations
@Deprecated
getChildback to summary
pack-priv synchronized RuntimeConfigurable getChild(int index)

Returns the child wrapper at the specified position within the list.

Parameters
index:int

The index of the child to return.

Returns:RuntimeConfigurable

The child wrapper at position index within the list.

getChildrenback to summary
public synchronized Enumeration<RuntimeConfigurable> getChildren()

Returns an enumeration of all child wrappers.

Returns:Enumeration<RuntimeConfigurable>

an enumeration of the child wrappers.

Since
Ant 1.6
getElementTagback to summary
public synchronized String getElementTag()

Returns the tag name of the wrapped element.

Returns:String

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

getIdback to summary
public synchronized String getId()

Returns the id for this element.

Returns:String

the id.

getPolyTypeback to summary
public synchronized String getPolyType()

Get the polymorphic type for this element.

Returns:String

the ant component type name, null if not set.

getProxyback to summary
public synchronized Object getProxy()

Get the object for which this RuntimeConfigurable holds the configuration information.

Returns:Object

the object whose configure is held by this instance.

getTextback to summary
public synchronized 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.

Returns:StringBuffer

the text content of this element.

Since
Ant 1.6
isEnabledback to summary
public boolean isEnabled(UnknownElement owner)

Check if an UE is enabled. This looks tru the attributes and checks if there are any Ant attributes, and if so, the method calls the isEnabled() method on them.

Parameters
owner:UnknownElement

the UE that owns this RC.

Returns:boolean

true if enabled, false if any of the ant attributes return false.

Annotations
@SuppressWarnings:deprecation
Since
1.9.1
isRestrictedAttributeback to summary
private RuntimeConfigurable.AttributeComponentInformation isRestrictedAttribute(String name, ComponentHelper componentHelper)
Parameters
name:String

the name of the attribute.

componentHelper:ComponentHelper

current component helper

Returns:RuntimeConfigurable.AttributeComponentInformation

AttributeComponentInformation instance

maybeConfigureback to summary
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:Project

The project containing the wrapped element. Must not be null.

Exceptions
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.
maybeConfigureback to summary
public synchronized 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:Project

The project containing the wrapped element. Must not be null.

configureChildren:boolean

ignored.

Exceptions
BuildException:
if the configuration fails, for instance due to invalid attributes, or text being added to an element which doesn't accept it.
reconfigureback to summary
public void reconfigure(Project p)

Reconfigure the element, even if it has already been configured.

Parameters
p:Project

the project instance for this configuration.

removeAttributeback to summary
public synchronized void removeAttribute(String name)

Delete an attribute. Not for the faint of heart.

Parameters
name:String

the name of the attribute to be removed.

setAttributeback to summary
public synchronized void setAttribute(String name, String value)

Set an attribute to a given value.

Parameters
name:String

the name of the attribute.

value:String

the attribute's value.

setAttributeback to summary
public synchronized void setAttribute(String name, Object value)

Set an attribute to a given value.

Parameters
name:String

the name of the attribute.

value:Object

the attribute's value.

Since
1.9
setAttributesback to summary
public synchronized void setAttributes(AttributeList attributes)

Deprecated

since 1.6.x.

Sets the attributes for the wrapped element.

Parameters
attributes:AttributeList

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

Annotations
@Deprecated
setCreatorback to summary
pack-priv synchronized void setCreator(IntrospectionHelper.Creator creator)

Sets the creator of the element to be configured used to store the element in the parent.

Parameters
creator:IntrospectionHelper.Creator

the creator object.

setElementTagback to summary
public synchronized void setElementTag(String elementTag)

Set the element tag.

Parameters
elementTag:String

The tag name generating this element.

setPolyTypeback to summary
public synchronized void setPolyType(String polyType)

Set the polymorphic type for this element.

Parameters
polyType:String

the ant component type name, null if not set.

setProxyback to summary
public synchronized void setProxy(Object proxy)

Sets the element to configure.

Parameters
proxy:Object

The element to configure. Must not be null.

org.apache.tools.ant back to summary

private Class RuntimeConfigurable.AttributeComponentInformation

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.tools.ant.RuntimeConfigurable.AttributeComponentInformation

contains the attribute component name and boolean restricted set to true when the attribute is in one of the name spaces managed by ant (if and unless currently)
Since
Ant 1.9.3

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv boolean

Constructor Summary

AccessConstructor and Description
private
AttributeComponentInformation(String componentName, boolean restricted)

Method Summary

Modifier and TypeMethod and Description
public String
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

componentNameback to summary
pack-priv String componentName
restrictedback to summary
pack-priv boolean restricted

Constructor Detail

AttributeComponentInformationback to summary
private AttributeComponentInformation(String componentName, boolean restricted)

Method Detail

getComponentNameback to summary
public String getComponentName()
isRestrictedback to summary
public boolean isRestricted()
org.apache.tools.ant back to summary

private Class RuntimeConfigurable.EnableAttributeConsumer

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.tools.ant.RuntimeConfigurable.EnableAttributeConsumer

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EnableAttributeConsumerback to summary
private EnableAttributeConsumer()

Method Detail

addback to summary
public void add(EnableAttribute b)
Annotations
@SuppressWarnings:unused