org.objectweb.jorm.metainfo.api
Interface GenClassRef
- MetaObject, Reference, Serializable, TypedElement
public interface GenClassRef
A GenClassRef is an interface which describes method to define
a class field which can be a reference to a generic class.
A GenClassRef object is composed by a PrimitiveElement (a primitive type),
or a ClassRef (a reference to a Class), or an another GenClassRef (a
reference to a generic class.
A recursion is defined when a GenClassRef object is composed by an other
GenClassRef object. A final object of the recursion is a PrimitiveElement
or a ClassRef objects.
- X. Spengler
addIndexField
public void addIndexField(String indexFieldName)
indexFieldName
- the name of the index field
createClassRef
public ClassRef createClassRef(Class clazz)
Creates a new ClassRef object, and attach it to the current GenClassRef
This method must be used when the recursion is finished (we are on
final object which is a ClassRef).
clazz
- the reference to the Class object which defines the
current GenClassRef object. This object is the final
object of the recursion.
- ClassRef a new ClassRef object
createGenClassRef
public GenClassRef createGenClassRef(String genClassRefName)
Creates a new GenClassRef object.
This method must be used when the recursion is not finished (we are on
not final object).
genClassRefName
- the name of the generic class used to create a
new GenClassRef object
- a new GenClassRef object
createHiddenField
public ScalarField createHiddenField(String fieldName,
PType type,
int size,
int scale)
Create a new hidden field for the refgenclass.
- the ScalarField
createIdNameDef
public NameDef createIdNameDef()
Creates a new NameDef object for the new GenClassRef object.
- a new object used to describe the PName projection for
the current Class
createPrimitiveElement
public PrimitiveElement createPrimitiveElement(PType type,
int size,
int scale)
Creates a new PrimitiveElement object, and attach it to the current GenClassRef
This method must be used when the recursion is finished (we are on
final object which is a PrimitiveElement).
type
- is the PType of the primitive element which will be created
- PrimitiveElement the primitive element which defines the current
GenClassRef object. This object is the final
object of the recursion.
getClassRef
public ClassRef getClassRef()
Returns the ClassRef object which defines the current GenClassRef object.
This method is used after a call to isClassRef() method, to determine if
the current object is defined by a final class or not.
- the final Class which describes the type of the object which
defines the GenClassRef object. This method always returns a
Class, and can not return null value because of the previous
test.
getGenClassId
public String getGenClassId()
Returns the id of the GenClass object. ("Set/List/String", ..)
- the id of the GenClassRef object
getGenClassName
public String getGenClassName()
Returns the name of the GenClass object. ("Set", ..)
- the name of the GenClassRef object
getGenClassRef
public GenClassRef getGenClassRef()
Returns the GenClassRef object which defines the current GenClassRef
object.
This object exists when it is in a recursion. This method is used after a
call to isGenClassRef() method, to determine if the current object is a
reference to a generic class or not.
- the underlying reference to the generic class. This method
always returns a GenClassRef, and can not return null value
because of the previous test.
getHiddenField
public ScalarField getHiddenField(String fieldName)
retrieve an hiddenfield from its name.
- the hiddenfield.
getHiddenFields
public Collection getHiddenFields()
return the collection of the hiddenfield of the refgenclass definition.
- the collection containing the hiddenfield (ScalarField).
getIdNameDef
public Collection getIdNameDef()
Returns an iterator on existing NameDef of GenClassRef object.
If no NameDef exists, an empty iterator is returned.
- an iterator on NameDef object
getIdNameDef
public NameDef getIdNameDef(String projectName)
Returns a NameDef object.
If the namedef does not exist, null is returned.
projectName
- the name of the project.
- an existing namedef object,else null is returned.
getIndexFields
public Collection getIndexFields()
Allows to know all the existing index field for the current generic
class.
This iterator contains PrimitiveElement objects. If no index field
exists, an empty iterator is returned.
- an Iterator on index field (PrimitiveElement). If there is no
index field to return, an empty iterator is returned.
getPrimitiveElement
public PrimitiveElement getPrimitiveElement()
Returns the PrimitiveElement object which defines the current GenClassRef
object.
This method is used after a call to isPrimitive() method, to determine
if the current object is a "basic" type.
- the current type of the field. This method always returns a
PType object, and can not return null value because of the
previous test.
isClassRef
public boolean isClassRef()
Allows to know if the current object is a reference to a Class or not.
- true, if the object is a reference to a Class, else false, if
the object is not a reference to a Class (either a primitive
object, or a reference to a generic class).
isGenClassRef
public boolean isGenClassRef()
Allows to know if the current object is a reference to a generic class
or not.
- true, if the object is a reference to a generic class, else
false, if the object is not a reference to a generic class
(either a primitive object, or a reference to a class).
isPrimitive
public boolean isPrimitive()
Allows to know if the current object is primitive or not (final and
"basic").
- true, if the current object is primitive, else false, if the
object is not primitive (either a reference to a Class, or
a reference to a generic class).
removeTypedElement
public TypedElement removeTypedElement(String fieldName)
Removes the primitive element.
fieldName
- is the name of the field to be removed
- the removed primitive element.