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.
Modifier and Type | Class and Description |
---|---|
private static class | IntrospectionHelper.AddNestedCreator
Version to use for addXXX and addConfiguredXXX |
private abstract static class | IntrospectionHelper.AttributeSetter
Internal interface used to setting element attributes. |
private static class | |
public static class | IntrospectionHelper.Creator
creator - allows use of create/store external to IntrospectionHelper. |
private static class | |
private abstract static class | IntrospectionHelper.NestedCreator
Internal interface used to create nested elements. |
Modifier and Type | Field and Description |
---|---|
private final Method | addText
The method to invoke to add PCDATA. |
private final List | addTypeMethods
Vector of methods matching add[Configured](Class) pattern. |
private final Map | attributeSetters
Map from attribute names to attribute setter methods (String to AttributeSetter). |
private final Map | attributeTypes
Map from attribute names to attribute types (String to Class). |
private final Class | bean
The class introspected by this instance. |
private static final String | |
private static final Map | HELPERS
Helper instances we've already created (Class.getName() to IntrospectionHelper). |
private static final int | |
private final Map | nestedCreators
Map from attribute names to methods to create nested types (String to NestedCreator). |
private final Map | nestedTypes
Map from attribute names to nested types (String to Class). |
protected static final String | NOT_SUPPORTED_CHILD_POSTFIX
part of the error message created by |
protected static final String | NOT_SUPPORTED_CHILD_PREFIX
part of the error message created by |
private static final Map | PRIMITIVE_TYPE_MAP
Map from primitive types to wrapper classes for use in createAttributeSetter (Class to Class). |
Access | Constructor and Description |
---|---|
private | IntrospectionHelper(final Class<?>
The bean type to introspect.
Must not be bean)null .Sole constructor, which is private to ensure that all
IntrospectionHelpers are created via |
Modifier and Type | Method and Description |
---|---|
public void | |
public static void | |
private String | |
private IntrospectionHelper. | Returns: a nested creator, or null if there is no component of the given name, or it has no matching add type methodsowning project project, final Object Parent object used to create the instance. parent, final String name of the element elementName)Create a NestedCreator for the given element. |
private IntrospectionHelper. | Returns: an appropriate AttributeSetter instance, ornull
if no appropriate conversion is available.The method to invoke on the bean when the setter is invoked.
Must not be m, final Class<?> null .The type of the single argument of the bean's method.
Must not be arg, final String null .the name of the attribute for which the setter is being
created. attrName)Creates an implementation of AttributeSetter for the given attribute type. |
private Object | createDynamicElement(final Object parent, final String ns, final String localName, final String qName)
Invokes the "correct" createDynamicElement method on parent in order to obtain a child element by name. |
public Object | Returns: an instance of the specified element typeProject to which the parent object belongs.
Must not be project, final Object null . If the resulting
object is an instance of ProjectComponent, its
Project reference is set to this parameter value.Parent object used to create the instance.
Must not be parent, final String null .Name of the element to create an instance of.
Must not be elementName)null .
Deprecated
since 1.6.x.
This is not a namespace aware method.
Creates a named nested element.
|
private IntrospectionHelper. | createRestricted(final ComponentHelper helper, final String elementName, final List<Method> addTypeMethods)
|
private IntrospectionHelper. | |
private static BuildException | Returns: the nested exceptionthe exception ite)Helper method to extract the inner fault from an |
private Method | Returns: a matchingMethod ; null if none found.the paramClass, final List<Method> Class type to search for.the methods)List of methods to search.Search the list of methods to find the first method that has a parameter that accepts the nested element object. |
private AntTypeDefinition | findRestrictedDefinition(final ComponentHelper helper, final String componentName, final List<Method> methods)
|
public Method | Returns: the method on this introspected class that adds nested text. Cannot benull .Returns the addText method when the introspected class supports nested text. |
public Map | Returns: an attribute name to attributeClass
unmodifiable map. Can be empty, but never null .Returns a read-only map of attributes supported by the introspected class. |
public Method | Returns: the method on this introspected class that sets this attribute. This will never benull .The name of the attribute to find the setter
method of. Must not be attributeName)null .Returns the setter method of a named attribute. |
public Enumeration | Returns: an enumeration of the names of the attributes supported by the introspected class.Returns an enumeration of the names of the attributes supported by the introspected class. |
public Class | Returns: the type of the attribute with the specified name. This will never benull .The name of the attribute to find the type of.
Must not be attributeName)null .Returns the type of a named attribute. |
public IntrospectionHelper. | Returns: a creator object to create and store the element instance.Project to which the parent object belongs. project, final String The namespace uri of the parent object. parentUri, final Object Parent object used to create the creator object to
create and store and instance of a subelement. parent, final String Name of the element to create an instance of. elementName, final UnknownElement The unknown element associated with the element. ue)returns an object that creates and stores an object for an element of a parent. |
public Method | Returns: the method on this introspected class that adds or creates this nested element. Can benull when the introspected
class is a dynamic configurator!The name of the attribute to find the setter
method of. Must not be elementName)null .Returns the adder or creator method of a named nested element. |
private String | Returns: a description of the element typeThe project the element is defined in. Must not be project, final Object null .The element to describe. Must not be element)null .Returns a description of the type of the given element in relation to a given project. |
public Class | Returns: the type of the nested element with the specified name. This will never benull .The name of the element to find the type of.
Must not be elementName)null .Returns the type of a named nested element. |
private IntrospectionHelper. | |
public List | Returns: a list of void, single argument add() or addConfigured()Method s of all supported extension points.
These methods are sorted such that if the argument type of a
method derives from another type also an argument of a method
of this list, the method with the most derived argument will
always appear first. Can be empty, but never null .Returns a read-only list of extension points supported by the introspected class. |
public static IntrospectionHelper | |
public static IntrospectionHelper | Returns: a helper for the specified classthe project instance. Can be null, in which case the helper is not cached. p, final Class<?> The class for which a helper is required.
Must not be c)null .Returns a helper for the given class, either from the cache or by creating a new instance. |
private IntrospectionHelper. | Returns: a nested creator that can handle the child elements.ant project project, String URI of the parent. parentUri, final Object the parent class parent, final String element to work with. This can contain
a URI,localname tuple of of the form uri:localname elementName, final UnknownElement the bit of XML to work with child)Get the specific NestedCreator for a given project/parent/element combination |
public Map | Returns: a nested-element name to nested-elementClass
unmodifiable map. Can be empty, but never null .Returns a read-only map of nested elements supported by the introspected class. |
public Enumeration | Returns: an enumeration of the names of the nested elements supported by the introspected class.Returns an enumeration of the names of the nested elements supported by the introspected class. |
private static String | Returns: the lower-cased method name with the prefix removed.The name of the method in question. Must not be methodName, final String null .The prefix to remove. Must not be prefix)null .Extracts the name of a property from a method name by subtracting a given prefix and converting into lower case. |
private void | insertAddTypeMethod(final Method
the method)Method to insert.Inserts an add or addConfigured method into the addTypeMethods array. |
public boolean | Returns: true if the introspected class is a container;
false otherwise.Indicates whether the introspected class is a task container, supporting arbitrary nested tasks/types. |
public boolean | Returns: true if the introspected class is dynamic;
false otherwise.Indicates whether the introspected class is a dynamic one, supporting arbitrary nested elements and/or attributes. |
private boolean | Returns: true if the given set method is to be hidden.the name of the set method name, final Class<?> the type of the set method's parameter type)Certain set methods are part of the Ant core interface to tasks and therefore not to be considered for introspection |
public void | setAttribute(final Project
The project containing the element. This is used when files
need to be resolved. Must not be p, final Object null .The element to set the attribute in. Must not be
element, final String null .The name of the attribute to set. Must not be
attributeName, final Object null .The value to set the attribute to. This may be interpreted
or converted to the necessary type if the setter method
doesn't accept an object of the supplied type. value)Sets the named attribute in the given element, which is part of the given project. |
public void | setAttribute(final Project
The project containing the element. This is used when files
need to be resolved. Must not be p, final Object null .The element to set the attribute in. Must not be
element, final String null .The name of the attribute to set. Must not be
attributeName, final String null .The value to set the attribute to. This may be interpreted
or converted to the necessary type if the setter method
doesn't just take a string. Must not be value)null .Sets the named attribute in the given element, which is part of the given project. |
public void | storeElement(final Project
Ignored in this implementation.
May be project, final Object null .Parent instance to store the child in.
Must not be parent, final Object null .Child instance to store in the parent.
Should not be child, final String null .Name of the child element to store.
May be elementName)null , in which case
this method returns immediately.Stores a named nested element using a storage method determined by the initial introspection. |
public boolean | Returns: whether or not the introspected class supports PCDATA.Returns whether or not the introspected class supports PCDATA. |
public boolean | Returns: true if the given nested element is supportedthe name of the nested element being checked elementName)Indicates if this element supports a nested element of the given name. |
public boolean | Returns: true if the given nested element is supportedthe uri of the parent parentUri, final String the name of the nested element being checked elementName)Indicate if this element supports a nested element of the given name. |
public boolean | Returns: true if the given nested element is supportedthe uri of the parent parentUri, final String the name of the nested element being checked elementName, final Project currently executing project instance project, final Object the parent element parent)Indicate if this element supports a nested element of the given name. |
public boolean | Returns: true if the given nested element is supportedthe uri of the parent parentUri, final String the name of the nested element being checked elementName)Check if this element supports a nested element from reflection. |
public void | throwNotSupported(final Project
the Project instance. project, final Object the object which doesn't support a requested element parent, final String the name of the Element which is trying to be created. elementName)Utility method to throw a NotSupported exception |