org.objectweb.jac.core.rtti
Class ConstructorItem

java.lang.Object
  extended byorg.objectweb.jac.core.rtti.MetaItem
      extended byorg.objectweb.jac.core.rtti.MetaItemDelegate
          extended byorg.objectweb.jac.core.rtti.MemberItem
              extended byorg.objectweb.jac.core.rtti.AbstractMethodItem
                  extended byorg.objectweb.jac.core.rtti.ConstructorItem

public class ConstructorItem
extends AbstractMethodItem

This class defines a meta item that corresponds to the java.lang.reflect.Constructor meta element.

Author:
Laurent Martelli, Renaud Pawlak

Field Summary
 
Fields inherited from class org.objectweb.jac.core.rtti.MemberItem
role, roleClassType, roleName, roleType
 
Fields inherited from class org.objectweb.jac.core.rtti.MetaItemDelegate
delegate, parent
 
Fields inherited from class org.objectweb.jac.core.rtti.MetaItem
attrACs
 
Constructor Summary
ConstructorItem(Constructor delegate, ClassItem parent)
          Default contructor to create a new constructor item object.
 
Method Summary
 Constructor getActualConstructor()
          Get the constructor represented by this constructor item.
 CollectionItem[] getAddedCollections()
           
 String getFullName()
          Return the full method name, ie with parameter types.
 String getName()
          This method gets the name of the meta item by delegating to the actual java.lang.reflect meta item.
 Class[] getParameterTypes()
          Gets the parameter types of this abstract method item.
 CollectionItem[] getRemovedCollections()
           
 FieldItem getSetField()
           
 Class getType()
          This method gets the type of the meta item by delegating to the actual java.lang.reflect meta item.
 Object invoke(Object substance, Object[] params)
           
 boolean isAccessor()
           
 boolean isAdder()
           
 boolean isCollectionAccessor()
           
 boolean isCollectionGetter()
           
 boolean isCollectionSetter()
           
 boolean isFieldGetter()
           
 boolean isFieldSetter()
           
 boolean isGetter()
           
 boolean isReferenceAccessor()
           
 boolean isReferenceGetter()
           
 boolean isReferenceSetter()
           
 boolean isRemover()
           
 boolean isSetter()
           
 boolean isWriter()
           
 Object newInstance()
          A nice way to construct a new instance when the constructor does not take any arguements (it throws an exception if it is not the case).
 Object newInstance(Object[] params)
          Creates a new instance of the class item that is parent of this constructor item.
static Constructor[] toConstructors(ConstructorItem[] constructorItems)
          Transforms a constructor items array into a constructors array containing the java.lang.reflect constructors wrapped by the constructor items.
 String toString()
          Overloads the default method to call the delegate one.
 
Methods inherited from class org.objectweb.jac.core.rtti.AbstractMethodItem
addAccessedField, addModifiedCollection, addWrittenField, getAccessedCollections, getAccessedFields, getAccessedReferences, getAddedCollection, getAttribute, getCompactFullName, getConcreteMethod, getFullName, getLongName, getModifiedCollections, getOwningClass, getParameter, getParameterCount, getParameterTypeItem, getRealFullName, getWrittenFields, hasModifiedCollections, hasWrittenFields, isModifier, isStatic, removeAccessedField, removeWrittenField, setAccessedFields, setParameter, setWrittenFields
 
Methods inherited from class org.objectweb.jac.core.rtti.MemberItem
addDependentMethod, equals, getClassItem, getDependentMethods, getMemberFromFullName, getModifiers, getTypeItem, isRole, setRole
 
Methods inherited from class org.objectweb.jac.core.rtti.MetaItemDelegate
getDelegate, getParent, setParent
 
Methods inherited from class org.objectweb.jac.core.rtti.MetaItem
getAttribute, getAttribute, getAttributeAlways, getBoolean, getItemClass, registerAccessController, setAttribute, setItemClass, unsetAttribute, unsetAttributesFor
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstructorItem

public ConstructorItem(Constructor delegate,
                       ClassItem parent)
                throws InvalidDelegateException
Default contructor to create a new constructor item object.

Parameters:
delegate - the java.lang.reflect.Constructor actual meta item
Method Detail

toConstructors

public static Constructor[] toConstructors(ConstructorItem[] constructorItems)
Transforms a constructor items array into a constructors array containing the java.lang.reflect constructors wrapped by the constructor items.

Parameters:
constructorItems - the Constructor items
Returns:
the actual Constructors in java.lang.reflect

getActualConstructor

public Constructor getActualConstructor()
Get the constructor represented by this constructor item.

Returns:
the actual constructor

getName

public String getName()
Description copied from class: MetaItem
This method gets the name of the meta item by delegating to the actual java.lang.reflect meta item.

Specified by:
getName in class MetaItem
Returns:
the item name

getType

public Class getType()
Description copied from class: MetaItemDelegate
This method gets the type of the meta item by delegating to the actual java.lang.reflect meta item.

Specified by:
getType in class MemberItem

newInstance

public Object newInstance(Object[] params)
                   throws InstantiationException,
                          IllegalAccessException,
                          InvocationTargetException
Creates a new instance of the class item that is parent of this constructor item.

Parameters:
params - the parameters needed by this constructor (see the types)
Throws:
InstantiationException
IllegalAccessException
InvocationTargetException
See Also:
getParameterTypes()

newInstance

public Object newInstance()
                   throws InstantiationException,
                          IllegalAccessException,
                          InvocationTargetException
A nice way to construct a new instance when the constructor does not take any arguements (it throws an exception if it is not the case).

Throws:
InstantiationException
IllegalAccessException
InvocationTargetException
See Also:
getParameterTypes()

invoke

public Object invoke(Object substance,
                     Object[] params)
Overrides:
invoke in class AbstractMethodItem

getParameterTypes

public Class[] getParameterTypes()
Description copied from class: AbstractMethodItem
Gets the parameter types of this abstract method item.

Specified by:
getParameterTypes in class AbstractMethodItem
Returns:
the actual method parameter types

toString

public String toString()
Description copied from class: MetaItemDelegate
Overloads the default method to call the delegate one.

Overrides:
toString in class AbstractMethodItem

getFullName

public String getFullName()
Description copied from class: AbstractMethodItem
Return the full method name, ie with parameter types.

Overrides:
getFullName in class AbstractMethodItem
Returns:
The full method name. For instance myMethod(java.lang.String,int)
See Also:
AbstractMethodItem.getCompactFullName()

isAdder

public final boolean isAdder()
Specified by:
isAdder in class AbstractMethodItem

getAddedCollections

public final CollectionItem[] getAddedCollections()
Specified by:
getAddedCollections in class AbstractMethodItem

getRemovedCollections

public final CollectionItem[] getRemovedCollections()
Specified by:
getRemovedCollections in class AbstractMethodItem

isSetter

public final boolean isSetter()
Specified by:
isSetter in class AbstractMethodItem

isRemover

public final boolean isRemover()
Specified by:
isRemover in class AbstractMethodItem

isAccessor

public final boolean isAccessor()
Specified by:
isAccessor in class AbstractMethodItem

isWriter

public final boolean isWriter()
Specified by:
isWriter in class AbstractMethodItem

isGetter

public final boolean isGetter()
Specified by:
isGetter in class AbstractMethodItem

isFieldGetter

public final boolean isFieldGetter()
Specified by:
isFieldGetter in class AbstractMethodItem

isFieldSetter

public final boolean isFieldSetter()
Specified by:
isFieldSetter in class AbstractMethodItem

isReferenceGetter

public final boolean isReferenceGetter()
Specified by:
isReferenceGetter in class AbstractMethodItem

isReferenceSetter

public final boolean isReferenceSetter()
Specified by:
isReferenceSetter in class AbstractMethodItem

isReferenceAccessor

public final boolean isReferenceAccessor()
Specified by:
isReferenceAccessor in class AbstractMethodItem

isCollectionGetter

public final boolean isCollectionGetter()
Specified by:
isCollectionGetter in class AbstractMethodItem

isCollectionSetter

public final boolean isCollectionSetter()
Specified by:
isCollectionSetter in class AbstractMethodItem

isCollectionAccessor

public final boolean isCollectionAccessor()
Specified by:
isCollectionAccessor in class AbstractMethodItem

getSetField

public final FieldItem getSetField()
Specified by:
getSetField in class AbstractMethodItem