org.apache.tools.ant
Class AntTypeDefinition
java.lang.Object
org.apache.tools.ant.AntTypeDefinition
public class AntTypeDefinition
extends java.lang.Object
This class contains all the information
on a particular ant type,
the classname, adaptor and the class
it should be assignable from.
This type replaces the task/datatype split
of pre ant 1.6.
checkClass
public void checkClass(Project project)
Checks if the attributes are correct.
if the class can be created.
if an adapter class can be created
if the type is assignable from adapto
if the type can be used with the adapter class
project
- the current project.
create
public Object create(Project project)
Create an instance of the definition.
The instance may be wrapped in a proxy class.
project
- the current project.
getClassLoader
public ClassLoader getClassLoader()
Get the classloader for this definition.
- the classloader for this definition.
getClassName
public String getClassName()
Get the classname of the definition.
- the name of the class of this definition.
getExposedClass
public Class getExposedClass(Project project)
Get the exposed class for this
definition. This will be a proxy class
(adapted class) if there is an adapter
class and the definition class is not
assignable from the assignable class.
project
- the current project.
getName
public String getName()
Return the definition's name.
- the name of the definition.
getTypeClass
public Class getTypeClass(Project project)
Get the definition class.
project
- the current project.
- the type of the definition.
innerCreateAndSet
public Object innerCreateAndSet(Class newclass,
Project project)
throws NoSuchMethodException,
InstantiationException,
IllegalAccessException,
InvocationTargetException
Inner implementation of the createAndSet(Project, Class)
logic, with no
exception catching
newclass
- class to createproject
- the project to use
- a newly constructed and bound instance.
innerGetTypeClass
public Class innerGetTypeClass()
throws ClassNotFoundException
Try and load a class, with no attempt to catch any fault.
- the class that implements this component
sameDefinition
public boolean sameDefinition(AntTypeDefinition other,
Project project)
Equality method for this definition (assumes the names are the same).
other
- another definition.project
- the project the definition.
- true if the definitions are the same.
setAdaptToClass
public void setAdaptToClass(Class adaptToClass)
Set the assignable class for this definition.
adaptToClass
- the assignable class.
setAdapterClass
public void setAdapterClass(Class adapterClass)
Set the adapter class for this definition.
This class is used to adapt the definitions class if
required.
adapterClass
- the adapterClass.
setClass
public void setClass(Class clazz)
Set the class of the definition.
As a side-effect may set the classloader and classname.
clazz
- the class of this definition.
setClassLoader
public void setClassLoader(ClassLoader classLoader)
Set the classloader to use to create an instance
of the definition.
classLoader
- the ClassLoader.
setClassName
public void setClassName(String className)
Set the classname of the definition.
className
- the classname of this definition.
setName
public void setName(String name)
Set the definition's name.
name
- the name of the definition.
similarDefinition
public boolean similarDefinition(AntTypeDefinition other,
Project project)
Similar definition;
used to compare two definitions defined twice with the same
name and the same types.
The classloader may be different but have the same
path so #sameDefinition cannot
be used.
other
- the definition to compare to.project
- the current project.
- true if the definitions are the same.