AntTypeDefinition (Apache Ant API)

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant
Class AntTypeDefinition

    java.lang.Object
      org.apache.tools.ant.AntTypeDefinition

Direct Known Subclasses:
  PreSetDef.PreSetDefinition

    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.

Constructor Summary
`AntTypeDefinition()`

Method Summary
`void` | `checkClass(Project project)` Checks if the attributes are correct.
`java.lang.Object` | `create(Project project)` Create an instance of the definition.
`java.lang.ClassLoader` | `getClassLoader()` Get the classloader for this definition.
`java.lang.String` | `getClassName()` Get the classname of the definition.
`java.lang.Class` | `getExposedClass(Project project)` Get the exposed class for this definition.
`java.lang.String` | `getName()` Return the definition's name.
`java.lang.Class` | `getTypeClass(Project project)` Get the definition class.
`java.lang.Object` | `innerCreateAndSet(java.lang.Class newclass, Project project)` Inner implementation of the `createAndSet(Project, Class)` logic, with no exception catching
`java.lang.Class` | `innerGetTypeClass()` Try and load a class, with no attempt to catch any fault.
`boolean` | `isRestrict()` Get the restrict attribute.
`boolean` | `sameDefinition(AntTypeDefinition other, Project project)` Equality method for this definition (assumes the names are the same).
`void` | `setAdapterClass(java.lang.Class adapterClass)` Set the adapter class for this definition.
`void` | `setAdaptToClass(java.lang.Class adaptToClass)` Set the assignable class for this definition.
`void` | `setClass(java.lang.Class clazz)` Set the class of the definition.
`void` | `setClassLoader(java.lang.ClassLoader classLoader)` Set the classloader to use to create an instance of the definition.
`void` | `setClassName(java.lang.String className)` Set the classname of the definition.
`void` | `setName(java.lang.String name)` Set the definition's name.
`void` | `setRestrict(boolean restrict)` Set the restrict attribute.
`boolean` | `similarDefinition(AntTypeDefinition other, Project project)` Similar definition; used to compare two definitions defined twice with the same name and the same types.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AntTypeDefinition

    public AntTypeDefinition()

Method Detail

### setRestrict

    public void setRestrict(boolean restrict)

  Set the restrict attribute.

  Parameters:
    `restrict` - the value to set.

### isRestrict

    public boolean isRestrict()

  Get the restrict attribute.

  Returns:
    the restrict attribute.

### setName

    public void setName(java.lang.String name)

  Set the definition's name.

  Parameters:
    `name` - the name of the definition.

### getName

    public java.lang.String getName()

  Return the definition's name.

  Returns:
    the name of the definition.

### setClass

    public void setClass(java.lang.Class clazz)

  Set the class of the definition. As a side-effect may set the classloader and classname.

  Parameters:
    `clazz` - the class of this definition.

### setClassName

    public void setClassName(java.lang.String className)

  Set the classname of the definition.

  Parameters:
    `className` - the classname of this definition.

### getClassName

    public java.lang.String getClassName()

  Get the classname of the definition.

  Returns:
    the name of the class of this definition.

### setAdapterClass

    public void setAdapterClass(java.lang.Class adapterClass)

  Set the adapter class for this definition. This class is used to adapt the definitions class if required.

  Parameters:
    `adapterClass` - the adapterClass.

### setAdaptToClass

    public void setAdaptToClass(java.lang.Class adaptToClass)

  Set the assignable class for this definition.

  Parameters:
    `adaptToClass` - the assignable class.

### setClassLoader

    public void setClassLoader(java.lang.ClassLoader classLoader)

  Set the classloader to use to create an instance of the definition.

  Parameters:
    `classLoader` - the ClassLoader.

### getClassLoader

    public java.lang.ClassLoader getClassLoader()

  Get the classloader for this definition.

  Returns:
    the classloader for this definition.

### getExposedClass

    public java.lang.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.

  Parameters:
    `project` - the current project.
  Returns:
    the exposed class - may return null if unable to load the class

### getTypeClass

    public java.lang.Class getTypeClass(Project project)

  Get the definition class.

  Parameters:
    `project` - the current project.
  Returns:
    the type of the definition.

### innerGetTypeClass

    public java.lang.Class innerGetTypeClass()
                                      throws java.lang.ClassNotFoundException

  Try and load a class, with no attempt to catch any fault.

  Returns:
    the class that implements this component
  Throws:
    `java.lang.ClassNotFoundException` - if the class cannot be found.
    `java.lang.NoClassDefFoundError` - if the there is an error finding the class.

### create

    public java.lang.Object create(Project project)

  Create an instance of the definition. The instance may be wrapped in a proxy class.

  Parameters:
    `project` - the current project.
  Returns:
    the created object.

### 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

  Parameters:
    `project` - the current project.

### innerCreateAndSet

    public java.lang.Object innerCreateAndSet(java.lang.Class newclass,
                                              Project project)
                                       throws java.lang.NoSuchMethodException,
                                              java.lang.InstantiationException,
                                              java.lang.IllegalAccessException,
                                              java.lang.reflect.InvocationTargetException

  Inner implementation of the `createAndSet(Project, Class)` logic, with no exception catching

  Parameters:
    `newclass` - class to create
    `project` - the project to use
  Returns:
    a newly constructed and bound instance.
  Throws:
    `java.lang.NoSuchMethodException` - no good construtor.
    `java.lang.InstantiationException` - cannot initialize the object.
    `java.lang.IllegalAccessException` - cannot access the object.
    `java.lang.reflect.InvocationTargetException` - error in invocation.

### sameDefinition

    public boolean sameDefinition(AntTypeDefinition other,
                                  Project project)

  Equality method for this definition (assumes the names are the same).

  Parameters:
    `other` - another definition.
    `project` - the project the definition.
  Returns:
    true if the definitions are the same.

### 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.

  Parameters:
    `other` - the definition to compare to.
    `project` - the current project.
  Returns:
    true if the definitions are the same.

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD