Save This Page
Home » apache-ant-1.7.1-src » org.apache.tools » ant » [javadoc | source]
org.apache.tools.ant
public final class: IntrospectionHelper [javadoc | source]
java.lang.Object
   org.apache.tools.ant.IntrospectionHelper
Helper class that collects the methods a task or nested element holds to set attributes, create nested elements or hold PCDATA elements. It contains hashtables containing classes that use introspection to handle all the invocation of the project-component specific methods. This class is somewhat complex, as it implements the O/X mapping between Ant XML and Java class instances. This is not the best place for someone new to Ant to start contributing to the codebase, as a change here can break the entire system in interesting ways. Always run a full test of Ant before checking in/submitting changes to this file. The class is final and has a private constructor. To get an instance for a specific (class,project) combination, use #getHelper(Project,Class) . This may return an existing version, or a new one ...do not make any assumptions about its uniqueness, or its validity after the Project instance has finished its build.
Nested Class Summary:
public static final class  IntrospectionHelper.Creator  creator - allows use of create/store external to IntrospectionHelper. The class is final as it has a private constructor. 
Method from org.apache.tools.ant.IntrospectionHelper Summary:
addText,   clearCache,   createElement,   getAddTextMethod,   getAttributeMap,   getAttributeMethod,   getAttributeType,   getAttributes,   getElementCreator,   getElementMethod,   getElementType,   getExtensionPoints,   getHelper,   getHelper,   getNestedElementMap,   getNestedElements,   isContainer,   isDynamic,   setAttribute,   storeElement,   supportsCharacters,   supportsNestedElement,   supportsNestedElement,   throwNotSupported
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tools.ant.IntrospectionHelper Detail:
 public  void addText(Project project,
    Object element,
    String text) throws BuildException 
    Adds PCDATA to an element, using the element's void addText(String) method, if it has one. If no such method is present, a BuildException is thrown if the given text contains non-whitespace.
 public static  void clearCache() 
    Clears the static cache of on build finished.
 public Object createElement(Project project,
    Object parent,
    String elementName) throws BuildException 
Deprecated! since - 1.6.x. This is not a namespace aware method.

    Creates a named nested element. Depending on the results of the initial introspection, either a method in the given parent instance or a simple no-arg constructor is used to create an instance of the specified element type.
 public Method getAddTextMethod() throws BuildException 
    Returns the addText method when the introspected class supports nested text.
 public Map getAttributeMap() 
    Returns a read-only map of attributes supported by the introspected class.
 public Method getAttributeMethod(String attributeName) throws BuildException 
    Returns the setter method of a named attribute.
 public Class getAttributeType(String attributeName) throws BuildException 
    Returns the type of a named attribute.
 public Enumeration getAttributes() 
    Returns an enumeration of the names of the attributes supported by the introspected class.
 public IntrospectionHelper.Creator getElementCreator(Project project,
    String parentUri,
    Object parent,
    String elementName,
    UnknownElement ue) 
    returns an object that creates and stores an object for an element of a parent.
 public Method getElementMethod(String elementName) throws BuildException 
    Returns the adder or creator method of a named nested element.
 public Class getElementType(String elementName) throws BuildException 
    Returns the type of a named nested element.
 public List getExtensionPoints() 
    Returns a read-only list of extension points supported by the introspected class.

    A task/type or nested element with void methods named add() or addConfigured(), taking a single class or interface argument, supports extensions point. This method returns the list of all these void add[Configured](type) methods.

 public static synchronized IntrospectionHelper getHelper(Class c) 
    Returns a helper for the given class, either from the cache or by creating a new instance.
 public static IntrospectionHelper getHelper(Project p,
    Class c) 
    Returns a helper for the given class, either from the cache or by creating a new instance. The method will make sure the helper will be cleaned up at the end of the project, and only one instance will be created for each class.
 public Map getNestedElementMap() 
    Returns a read-only map of nested elements supported by the introspected class.
 public Enumeration getNestedElements() 
    Returns an enumeration of the names of the nested elements supported by the introspected class.
 public boolean isContainer() 
    Indicates whether the introspected class is a task container, supporting arbitrary nested tasks/types.
 public boolean isDynamic() 
    Indicates whether the introspected class is a dynamic one, supporting arbitrary nested elements and/or attributes.
 public  void setAttribute(Project p,
    Object element,
    String attributeName,
    String value) throws BuildException 
    Sets the named attribute in the given element, which is part of the given project.
 public  void storeElement(Project project,
    Object parent,
    Object child,
    String elementName) throws BuildException 
    Stores a named nested element using a storage method determined by the initial introspection. If no appropriate storage method is available, this method returns immediately.
 public boolean supportsCharacters() 
    Returns whether or not the introspected class supports PCDATA.
 public boolean supportsNestedElement(String elementName) 
    Indicates if this element supports a nested element of the given name.
 public boolean supportsNestedElement(String parentUri,
    String elementName) 
    Indicate if this element supports a nested element of the given name.
 public  void throwNotSupported(Project project,
    Object parent,
    String elementName) 
    Utility method to throw a NotSupported exception