|
JAC project AOPSYS CEDRIC & LIP6 labs |
|||||||||
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.FieldItem
This class defines a meta item that corresponds to the
java.lang.reflect.Field
meta element.
In addition to the java.lang.reflect
classical
features, this RTTI method element is able to tell if a field is
accessed for reading or writting by a given method.
It also provides some modification methods that are aspect compliant.
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.
Field
,
getWritingMethods()
,
getAccessingMethods()
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 | |
FieldItem(ClassItem parent)
|
|
FieldItem(Field delegate,
ClassItem parent)
Default contructor to create a new field item object. |
|
FieldItem(String expression,
List path,
ClassItem parent)
Creates an expression FieldItem |
|
FieldItem(String name,
MethodItem getter,
ClassItem parent)
Creates a calculated FieldItem |
|
FieldItem(String name,
MethodItem getter,
MethodItem setter,
ClassItem parent)
Creates a FieldItem with specific getter and setter |
Method Summary | |
void |
addAccessingMethod(MethodItem accessingMethod)
Add a new accessing method for this field. |
void |
addDependentField(FieldItem field)
|
void |
addWritingMethod(MethodItem writingMethod)
Add a new writing method for this field. |
void |
clearMethods()
Remove accessing and writing methods |
FieldItem |
clone(ClassItem parent)
|
Object |
get(Object object)
Get the value of this field item for a given object. |
MethodItem[] |
getAccessingMethods()
Get the methods that access this field for reading. |
Field |
getActualField()
Get the field represented by this field item. |
Object |
getAttribute(String name)
If the field does not have a value for the request attribute, tries on the superclass. |
FieldItem[] |
getDependentFields()
Returns an array of calculated fields which depend on the field. |
FieldItem |
getField()
Returns the actual field. |
MethodItem |
getGetter()
Returns the getter of the field, if any. |
int |
getModifiers()
Get the modifiers (see java.lang.reflect) of the meta item. |
String |
getName()
This method gets the name of the meta item by delegating to the actual java.lang.reflect meta item. |
FieldItem |
getPathTop()
|
MethodItem |
getSetter()
|
Object |
getSubstance(Object substance)
Returns proper substance to invoke methods on for expression fields. |
Object |
getThroughAccessor(Object substance)
Get a field value through accessor if it exists. |
Class |
getType()
This method gets the type of the meta item by delegating to the actual java.lang.reflect meta item. |
MethodItem[] |
getWritingMethods()
Get the methods that access this field for writing. |
boolean |
hasAccessingMethods()
|
boolean |
hasWritingMethods()
|
boolean |
isCalculated()
Tells whether the field is transient or not. |
boolean |
isFinal()
|
boolean |
isPrimitive()
Tells if this field item represents a primitive type (that is to say it is of a type that is not a reference towards a Jac object). |
boolean |
isReference()
Tells if this field item represents a reference type (that is to say it is of a type that is a reference towards a Jac object). |
boolean |
isStatic()
|
boolean |
isTransient()
Tells whether the field is transient or not. |
boolean |
isWrappable(Object substance)
Tells if the field item represents a wrappable type. |
protected FieldItem |
lastField()
|
void |
set(Object object,
Object value)
Sets the value of this field item for a given object. |
void |
setAccessingMethods(MethodItem[] accessingMethods)
Set the methods that access this field for reading. |
void |
setGetter(MethodItem getter)
|
void |
setSetter(MethodItem setter)
|
void |
setThroughWriter(Object substance,
Object value)
Sets the value of this field item by using its setter method if any (else use the set method. |
void |
setType(Class type)
|
void |
setWritingMethods(MethodItem[] writingMethods)
Set the methods that access this field for writing. |
static Field[] |
toFields(FieldItem[] fieldItems)
Transforms a field items array into a fields array containing the java.lang.reflect fields wrapped by the method
items. |
String |
toString()
Overloads the default method to call the delegate one. |
Methods inherited from class org.objectweb.jac.core.rtti.MemberItem |
addDependentMethod, equals, getClassItem, getDependentMethods, getLongName, getMemberFromFullName, 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 |
public FieldItem(Field delegate, ClassItem parent) throws InvalidDelegateException
delegate
- the java.lang.reflect.Field
actual
meta itempublic FieldItem(ClassItem parent)
public FieldItem(String name, MethodItem getter, ClassItem parent)
name
- name of the fieldgetter
- the getter method of the fieldpublic FieldItem(String name, MethodItem getter, MethodItem setter, ClassItem parent)
name
- name of the fieldgetter
- the getter method of the fieldsetter
- the setter method of the fieldpublic FieldItem(String expression, List path, ClassItem parent)
expression
- expression of the fieldMethod Detail |
public static Field[] toFields(FieldItem[] fieldItems)
java.lang.reflect
fields wrapped by the method
items.
fieldItems
- the field items
java.lang.reflect
public FieldItem getPathTop()
public final Object getAttribute(String name)
getAttribute
in class MetaItem
name
- the name of the attribute
public final MethodItem[] getAccessingMethods()
public final boolean hasAccessingMethods()
public final void setAccessingMethods(MethodItem[] accessingMethods)
accessingMethods
- value to assign to accessingMethods.public final void addAccessingMethod(MethodItem accessingMethod)
accessingMethod
- the method to addpublic final MethodItem[] getWritingMethods()
public final boolean hasWritingMethods()
public final void setWritingMethods(MethodItem[] writingMethods)
writingMethods
- value to assign to writingMethods.public final void addWritingMethod(MethodItem writingMethod)
writingMethod
- the method to addpublic void clearMethods()
public final void addDependentField(FieldItem field)
getDependentFields()
public final FieldItem[] getDependentFields()
addDependentField(FieldItem)
public final Field getActualField()
public Object getSubstance(Object substance)
public FieldItem getField()
public final Object get(Object object)
object
- the object that supports the field
set(Object,Object)
public Object getThroughAccessor(Object substance)
public final void set(Object object, Object value) throws IllegalAccessException, IllegalArgumentException
object
- the object that supports the fieldvalue
- the value to set
IllegalAccessException
IllegalArgumentException
get(Object)
public final void setThroughWriter(Object substance, Object value) throws IllegalAccessException, IllegalArgumentException
set
method.
value
- the new value of the field
IllegalAccessException
IllegalArgumentException
set(Object,Object)
public MethodItem getSetter()
public void setSetter(MethodItem setter)
public MethodItem getGetter()
public void setGetter(MethodItem getter)
public String getName()
MetaItem
java.lang.reflect
meta item.
getName
in class MetaItem
public Class getType()
MetaItemDelegate
java.lang.reflect
meta item.
getType
in class MemberItem
public void setType(Class type)
public boolean isPrimitive()
Allways returns false on collections (use
isWrappable
to know if the field is wrappable).
isReference()
public boolean isReference()
Allways returns false on collections (use
isWrappable
to know if the field is wrappable).
isPrimitive()
,
isWrappable(Object)
public boolean isWrappable(Object substance)
This method can be used on all kinds of field item including
collections (on contrary to isPrimitive
and
isReference
).
isPrimitive()
,
isReference()
public boolean isTransient()
public boolean isFinal()
public boolean isStatic()
public int getModifiers()
MetaItemDelegate
getModifiers
in class MemberItem
Modifier
protected FieldItem lastField()
public boolean isCalculated()
public FieldItem clone(ClassItem parent)
public String toString()
MetaItemDelegate
toString
in class MetaItemDelegate
|
Contact JAC development team: Renaud Pawlak Lionel Seinturier Laurent Martelli |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |