|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.objectweb.jac.core.rtti.MetaItem
|
+--org.objectweb.jac.core.rtti.MetaItemDelegate
|
+--org.objectweb.jac.core.rtti.MemberItem
|
+--org.objectweb.jac.core.rtti.AbstractMethodItem
|
+--org.objectweb.jac.core.rtti.MethodItem
This class defines a meta item that corresponds to the
java.lang.reflect.Method meta element.
In addition to the java.lang.reflect classical
features, this RTTI method element is able to tell if a method is a
setter, a getter, or more generally speaking, a state modifier for
a given field of the object it belongs to. And, if this field is a
collection (an array, a list or a map), then this meta element is
able to tell if the method it represents adds or removes elements
to or from this collection.
It also provides to introspection features for references on Jac objects.
For the moment, default meta informations are setted by the
ClassRepository class using some naming
conventions. In a close future, these informations will be deduced
from the class bytecodes analysis at load-time.
Method,
AbstractMethodItem.getWrittenFields(),
AbstractMethodItem.getAccessedFields(),
getAddedCollections(),
getRemovedCollections(),
AbstractMethodItem.isModifier(),
hasAccessedReferences()| Field Summary | |
static MethodItem[] |
emptyArray
|
| 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 | |
MethodItem(Method delegate,
ClassItem parent)
Default contructor to create a new method item object. |
|
| Method Summary | |
void |
addAccessedField(FieldItem accessedField)
Adds a new accessed field for this method. |
void |
addAddedCollection(CollectionItem addedCollection)
Adds a new added collection for this method. |
void |
addRemovedCollection(CollectionItem removedCollection)
Adds a new removed collection for this method. |
Method |
getActualMethod()
Gets the method represented by this method item. |
CollectionItem[] |
getAddedCollections()
Get the value of the collections that are added by this method. |
int |
getCollectionIndexArgument()
Returns the number of the argument which is the index of a modified collection if any, -1 otherwise. |
int |
getCollectionItemArgument()
Returns the number of the argument which is the item that will be added to a collection if any, -1 otherwise. |
String |
getName()
This method gets the name of the meta item by delegating to the actual java.lang.reflect meta item. |
Method |
getOrgMethod()
|
Class[] |
getParameterTypes()
Gets the parameter types of this abstract method item. |
CollectionItem |
getRemovedCollection()
|
CollectionItem[] |
getRemovedCollections()
Gets the value of the collections that are removed by this method. |
FieldItem |
getReturnedField()
Returns the field item corresponding to the field value returned by this method, if any. |
FieldItem |
getSetField()
Returns the field set by this method, if any. |
Class |
getType()
This method gets the type of the meta item by delegating to the actual java.lang.reflect meta item. |
boolean |
hasAccessedReferences()
Tells if this method accesses any references of the class it belongs to. |
boolean |
hasAddedCollections()
Returns true if the method has at least one added collection |
boolean |
hasRemovedCollections()
Returns true if the method has at least one removed collection |
Object |
invoke(Object object,
Object[] parameters)
Invokes this method on the given object and with the given parameters values. |
Object |
invokeStatic(Object[] parameters)
Invokes this static method with the given parameters values. |
Object |
invokeWithInit(Object object,
Object[] parameters)
Invokes a method with uninitialized parameters. |
boolean |
isAccessor()
|
boolean |
isAdder()
Tells wether the method is an adder of a collection |
boolean |
isCollectionAccessor()
|
boolean |
isCollectionGetter()
|
boolean |
isCollectionSetter()
|
boolean |
isFieldGetter()
|
boolean |
isFieldSetter()
|
boolean |
isGetter()
Tells wether the method returns the value of a field |
boolean |
isJacMethod()
Tells wether the method was introduced by JAC |
boolean |
isReferenceAccessor()
|
boolean |
isReferenceGetter()
|
boolean |
isReferenceSetter()
|
boolean |
isRemover()
Tells wether the method is a remover of a collection |
boolean |
isSetter()
Tells wether the method is the setter of a field |
boolean |
isWriter()
|
void |
removeAddedCollection(CollectionItem collection)
Removes an existing added collection for this method. |
void |
removeRemovedCollection(CollectionItem collection)
Removes an existing removed collection for this method. |
void |
setAddedCollections(CollectionItem[] addedCollections)
Sets the value of the collections that are added by this method. |
void |
setCollectionIndexArgument(int collectionIndexArgument)
Sets collectionIndexArgument |
void |
setCollectionItemArgument(int collectionItemArgument)
Sets collectionItemArgument |
void |
setRemovedCollections(CollectionItem[] removedCollections)
Sets the value of the collections that are removed by this method. |
void |
setReturnedField(FieldItem returnedField)
Sets the field returned by the method. |
void |
setSetField(FieldItem setField)
Sets the field set by the method. |
static Method[] |
toMethods(MethodItem[] methodItems)
Transforms a method items array into a methods array containing the java.lang.reflect methods wrapped by the method
items. |
| 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 |
| Field Detail |
public static final MethodItem[] emptyArray
| Constructor Detail |
public MethodItem(Method delegate,
ClassItem parent)
throws InvalidDelegateException
delegate - the java.lang.reflect.Method actual
meta item| Method Detail |
public static Method[] toMethods(MethodItem[] methodItems)
java.lang.reflect methods wrapped by the method
items.
methodItems - the method items
java.lang.reflectpublic final Method getOrgMethod()
public final boolean hasAccessedReferences()
public final FieldItem getReturnedField()
setReturnedField(FieldItem)public void setReturnedField(FieldItem returnedField)
getReturnedField()public final FieldItem getSetField()
getSetField in class AbstractMethodItemsetReturnedField(FieldItem)public void setSetField(FieldItem setField)
getSetField()public final CollectionItem[] getAddedCollections()
getAddedCollections in class AbstractMethodItempublic final boolean hasAddedCollections()
public final void setAddedCollections(CollectionItem[] addedCollections)
addedCollections - value to assign to addedCollectionsaddAddedCollection(CollectionItem)public final void addAddedCollection(CollectionItem addedCollection)
addedCollection - the collection to addremoveAddedCollection(CollectionItem)public final void removeAddedCollection(CollectionItem collection)
collection - the collection to addaddAddedCollection(CollectionItem)public final Method getActualMethod()
public final String getName()
MetaItemjava.lang.reflect meta item.
getName in class MetaItempublic final Class getType()
MetaItemDelegatejava.lang.reflect meta item.
getType in class MemberItempublic Class[] getParameterTypes()
AbstractMethodItem
getParameterTypes in class AbstractMethodItempublic int getCollectionIndexArgument()
public void setCollectionIndexArgument(int collectionIndexArgument)
getCollectionIndexArgument()public int getCollectionItemArgument()
public void setCollectionItemArgument(int collectionItemArgument)
getCollectionItemArgument()public void addAccessedField(FieldItem accessedField)
AbstractMethodItem
addAccessedField in class AbstractMethodItemaccessedField - the field to addAbstractMethodItem.setAccessedFields(FieldItem[]),
AbstractMethodItem.removeAccessedField(FieldItem)
public Object invoke(Object object,
Object[] parameters)
invoke in class AbstractMethodItemobject - a class this method belongs to intanceparameters - the values of the parameters to invoke this
method withpublic final Object invokeStatic(Object[] parameters)
parameters - the values of the parameters to invoke this
method with
public final Object invokeWithInit(Object object,
Object[] parameters)
throws IllegalAccessException,
InvocationTargetException
The parameters array is initialized before the invocation with default values.
object - the target objectparameters - the maybe initialized values of the parameters
to invoke this method with (primitive parameters can be null)
IllegalAccessException
InvocationTargetExceptionpublic final boolean isGetter()
isGetter in class AbstractMethodItempublic final boolean isCollectionGetter()
isCollectionGetter in class AbstractMethodItempublic final boolean isSetter()
isSetter in class AbstractMethodItempublic final boolean isAdder()
isAdder in class AbstractMethodItempublic final CollectionItem[] getRemovedCollections()
getRemovedCollections in class AbstractMethodItempublic final CollectionItem getRemovedCollection()
public final boolean hasRemovedCollections()
public final void setRemovedCollections(CollectionItem[] removedCollections)
removedCollections - value to assign to removedCollectionsaddRemovedCollection(CollectionItem)public final void addRemovedCollection(CollectionItem removedCollection)
removedCollection - the collection to addsetRemovedCollections(CollectionItem[]),
removeRemovedCollection(CollectionItem)public final void removeRemovedCollection(CollectionItem collection)
collection - the collection to removeaddRemovedCollection(CollectionItem)public final boolean isRemover()
isRemover in class AbstractMethodItempublic final boolean isAccessor()
isAccessor in class AbstractMethodItempublic final boolean isWriter()
isWriter in class AbstractMethodItempublic final boolean isCollectionAccessor()
isCollectionAccessor in class AbstractMethodItempublic final boolean isReferenceAccessor()
isReferenceAccessor in class AbstractMethodItempublic final boolean isCollectionSetter()
isCollectionSetter in class AbstractMethodItempublic final boolean isFieldSetter()
isFieldSetter in class AbstractMethodItempublic final boolean isReferenceSetter()
isReferenceSetter in class AbstractMethodItempublic final boolean isFieldGetter()
isFieldGetter in class AbstractMethodItempublic final boolean isReferenceGetter()
isReferenceGetter in class AbstractMethodItempublic final boolean isJacMethod()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||