|
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.AspectComponent | +--org.objectweb.jac.core.rtti.RttiAC
This class defines the rtti aspect.
It allows the programmer to add some runtime type informations on the classes of its applications.
ClassItem
,
MethodItem
,
FieldItem
,
CollectionItem
,
Serialized FormField Summary | |
static String |
AUTHORIZED_VALUES
|
static String |
CLONED_FIELDS
|
static String |
CONSTRAINTS
|
static String |
FIELD_TYPE
|
static String |
FORBIDDEN_VALUES
|
static String |
INDEXED_FIELD
|
static String |
IS_INDEX
|
static String |
NULL_ALLOWED
|
static String |
NULL_ALLOWED_PARAMETERS
|
static String |
OPPOSITE_ROLE
|
static String |
PARAMETER_TYPES
|
static String |
PARAMETERS_FIELDS
|
static String |
PRIMARY_KEY
|
static String |
REPOSITORY_COLLECTION
|
static String |
REPOSITORY_NAME
|
Fields inherited from class org.objectweb.jac.core.AspectComponent |
application, blockKeywords, firstCall, NOT_SHARED, SHARED, startWeavingCCount, startWeavingCount, startWeavingMethod, startWeavingType, systemListener, wrappers |
Fields inherited from interface org.objectweb.jac.core.BaseProgramListener |
FOUND_OBJECT |
Constructor Summary | |
RttiAC()
|
Method Summary | |
void |
addAccessedFields(MethodItem method,
String[] accessedFields)
Adds some accessed fields to a given method. |
void |
addAdder(CollectionItem collection,
String methodName)
Adds an adding method for a collection |
void |
addDependentField(FieldItem field,
String dependentField)
Declares a field dependency. |
void |
addRemover(CollectionItem collection,
String methodName)
Adds a removing method for a collection |
void |
addRoot(String name)
This configuration method defines root objects. |
void |
addWrittenFields(AbstractMethodItem method,
String[] writtenFields)
Adds some written fields to a given method. |
void |
declareCalculatedField(ClassItem cl,
String fieldName,
String getterName)
Declare a calculated field, which is a field with only a getter and no actual field. |
void |
definePrimaryKey(CollectionItem collection,
String[] fields)
Defines primary keys for a collection. |
void |
defineRepository(ClassItem type,
String repositoryName,
CollectionItem repositoryCollection)
Declare a repository to which all instances of type will be automatically added. |
String[] |
getDefaultConfigs()
Returns defaults configuration files that must be loaded before the user's configuration |
static MetaItem |
getFieldType(FieldItem field)
|
static FieldItem |
getIndexFied(CollectionItem collection)
|
static Collection |
getRoots()
Returns all the root objects defined by the aspect configuration. |
void |
ignoreFields(String packageExpr)
|
void |
introduce(ClassItem target,
ClassItem roleType,
String memeberType,
String memberName)
Introduces a new member (field or method) into a given class. |
static boolean |
isCollectionType(Class type)
Tells wether a given type represents a collection |
static boolean |
isIndex(CollectionItem collection)
|
static boolean |
isNullAllowed(FieldItem field)
|
static boolean |
isNullAllowedParameter(AbstractMethodItem method,
int i)
|
void |
newVirtualClass(String className,
ClassItem actualType)
Create a new virtual class. |
void |
setAdder(CollectionItem collection,
String methodName)
Sets the adder of a collection. |
void |
setClass(ClassItem cli,
String className)
Sets a user defined class on a class. |
void |
setClass(MemberItem member,
String className)
Sets a user defined class on a class' member. |
void |
setClonedFields(String className,
String[] fields)
This configuration method tells that the fields (references or collections) must be cloned when the class is cloned. |
void |
setComponentType(CollectionItem collection,
String type)
Sets the component type of a collection, i.e. |
void |
setFieldType(FieldItem field,
String type)
Declare a field to be of a given type |
void |
setIndexedField(CollectionItem collection,
FieldItem indexedField)
Tells that a Map implementing a collection indexes a field of the contained objects. |
void |
setIsIndex(CollectionItem collection,
boolean isIndex)
Specify wether a Map implementing a collection is a mere index for the collection (this is not the default). |
void |
setNullAllowed(FieldItem field)
This configuration method tells that the field can be set to null (forbidden by default) |
void |
setNullAllowed(FieldItem field,
boolean allowed)
This configuration method tells wether the field can be set to null or not. |
void |
setNullAllowedParameters(AbstractMethodItem method,
boolean[] nulls)
Tells if JAC object-typed (references) arguments of a method can take null value while the method's invocation or if they should be choosen in existing instances list. |
void |
setParametersFields(AbstractMethodItem method,
FieldItem[] fields)
Specifies that the parameters of a method will be assigned to a given field. |
void |
setParametersType(AbstractMethodItem method,
String[] types)
Declare a method's parameters to be of a given type |
void |
setRemover(CollectionItem collection,
String methodName)
Sets the remover of a collection. |
void |
whenClone(Wrappee cloned,
Wrappee clone)
This method is automatically called when a Jac Object is cloned. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String OPPOSITE_ROLE
public static final String FIELD_TYPE
public static final String PARAMETER_TYPES
public static final String CLONED_FIELDS
public static final String REPOSITORY_NAME
public static final String REPOSITORY_COLLECTION
public static final String NULL_ALLOWED_PARAMETERS
public static final String NULL_ALLOWED
public static final String IS_INDEX
public static final String INDEXED_FIELD
public static final String AUTHORIZED_VALUES
public static final String FORBIDDEN_VALUES
public static final String CONSTRAINTS
public static final String PARAMETERS_FIELDS
public static final String PRIMARY_KEY
Constructor Detail |
public RttiAC()
Method Detail |
public void addWrittenFields(AbstractMethodItem method, String[] writtenFields)
RttiConf
This configuration method must be used when a method changes some field values and does not follow the naming conventions (it is not a setter or an adder for instance).
addWrittenFields
in interface RttiConf
method
- the methodwrittenFields
- some new fields the method writespublic void declareCalculatedField(ClassItem cl, String fieldName, String getterName)
RttiConf
declareCalculatedField
in interface RttiConf
cl
- the class item of te calculated fieldfieldName
- the name of the calculated fieldgetterName
- the name of the getter methodRttiConf.addDependentField(FieldItem,String)
public void addDependentField(FieldItem field, String dependentField)
RttiConf
addDependentField
in interface RttiConf
field
- the field to refreshdependentField
- the name of the field it depends on. It
must be in the same class ass field.RttiConf.declareCalculatedField(ClassItem,String,String)
public void addAdder(CollectionItem collection, String methodName)
RttiConf
addAdder
in interface RttiConf
collection
- the collection's namemethodName
- the name of the adding methodpublic void setAdder(CollectionItem collection, String methodName)
RttiConf
setAdder
in interface RttiConf
collection
- the collectionmethodName
- the name of the adder methodpublic void addRemover(CollectionItem collection, String methodName)
RttiConf
addRemover
in interface RttiConf
collection
- the collectionmethodName
- the name of the removing methodpublic void setRemover(CollectionItem collection, String methodName)
RttiConf
setRemover
in interface RttiConf
collection
- the collection's namemethodName
- the name of the remover methodpublic void addAccessedFields(MethodItem method, String[] accessedFields)
RttiConf
This configuration method must be used when a method reads some field values and does not follow the naming conventions (it is not a getter for instance).
addAccessedFields
in interface RttiConf
method
- the methodpublic void setFieldType(FieldItem field, String type)
RttiConf
setFieldType
in interface RttiConf
type
- the typepublic void setComponentType(CollectionItem collection, String type)
RttiConf
setComponentType
in interface RttiConf
collection
- the collectiontype
- the component type of the collectionpublic static MetaItem getFieldType(FieldItem field)
public void setParametersType(AbstractMethodItem method, String[] types)
RttiConf
setParametersType
in interface RttiConf
method
- the methodpublic void newVirtualClass(String className, ClassItem actualType)
RttiConf
newVirtualClass
in interface RttiConf
className
- name of the new classactualType
- the actual primitive type that is extendedpublic void defineRepository(ClassItem type, String repositoryName, CollectionItem repositoryCollection)
RttiConf
defineRepository
in interface RttiConf
type
- the type of objects to add in the repositoryrepositoryName
- the name of the object holding the repositoryrepositoryCollection
- the collection to add the objects topublic void addRoot(String name)
RttiConf
Root objects are never garbaged since they are considered as an entry point to retrieve the application objects that are related to them.
addRoot
in interface RttiConf
name
- the name of the root objectpublic static Collection getRoots()
addRoot(String)
public void setClonedFields(String className, String[] fields)
RttiConf
setClonedFields
in interface RttiConf
className
- the class namefields
- the names of the fields that are clonedpublic void whenClone(Wrappee cloned, Wrappee clone)
AspectComponent
whenClone
in interface BaseProgramListener
whenClone
in class AspectComponent
cloned
- the object that is being clonedclone
- the new object (the clone of cloned)public void ignoreFields(String packageExpr)
public void setClass(MemberItem member, String className)
RttiConf
setClass
in interface RttiConf
member
- the member whose type to redefineclassName
- the new class namepublic void setClass(ClassItem cli, String className)
RttiConf
setClass
in interface RttiConf
cli
- the class to redefineclassName
- the new class namepublic void introduce(ClassItem target, ClassItem roleType, String memeberType, String memberName)
RttiConf
The target class does not declare the member but is wrapped by a wrapper that contains a member that should be considered as a base-object member.
Once introduced, the member will behave like a regular member if accessed or setted through the RTTI.
introduce
in interface RttiConf
target
- the target class where to add the memeberroleType
- the type of the role wrapper that actually
contains the memberpublic void setParametersFields(AbstractMethodItem method, FieldItem[] fields)
RttiConf
Other aspects (such as the GUI aspect) may use this information to provide better default behaviour for the paramters.
setParametersFields
in interface RttiConf
method
- the of the methodfields
- an array of field items, one per parameter of the
method. Elements of this array may be null if some parameters
are not assigned to any field.public void setNullAllowed(FieldItem field)
RttiConf
setNullAllowed
in interface RttiConf
#setNullAllowed(ClassItem,String,boolean)
public void setNullAllowed(FieldItem field, boolean allowed)
RttiConf
setNullAllowed
in interface RttiConf
field
- the fieldallowed
- wether to allow null values#setNullAllowed(ClassItem,String)
public static boolean isNullAllowed(FieldItem field)
public void setNullAllowedParameters(AbstractMethodItem method, boolean[] nulls)
RttiConf
setNullAllowedParameters
in interface RttiConf
method
- the methodnulls
- a flags array that tells for each parameter whether
it can be null (true) or not (false). It has no effect if the
parameter is not a JAC object (a reference)public static boolean isNullAllowedParameter(AbstractMethodItem method, int i)
public void setIndexedField(CollectionItem collection, FieldItem indexedField)
RttiConf
setIndexedField
in interface RttiConf
RttiConf.setIsIndex(CollectionItem,boolean)
,
CollectionItem.getActualCollection(Object)
,
CollectionItem.getActualCollectionThroughAccessor(Object)
public void setIsIndex(CollectionItem collection, boolean isIndex)
RttiConf
setIsIndex
in interface RttiConf
isIndex
- wether the map is an indexRttiConf.setIndexedField(CollectionItem,FieldItem)
,
CollectionItem.getActualCollection(Object)
,
CollectionItem.getActualCollectionThroughAccessor(Object)
public static FieldItem getIndexFied(CollectionItem collection)
public static boolean isIndex(CollectionItem collection)
public String[] getDefaultConfigs()
AspectComponent
getDefaultConfigs
in class AspectComponent
public void definePrimaryKey(CollectionItem collection, String[] fields)
RttiConf
It is used to check for double entries in the collection by checking the precised fields (it is the same as primary keys in a database).
definePrimaryKey
in interface RttiConf
public static boolean isCollectionType(Class type)
|
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 |