org.objectweb.jorm.metainfo.api

Interface GenClassRef

All Superinterfaces:
MetaObject, Reference, Serializable, TypedElement

public interface GenClassRef
extends Reference

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.

Author:
X. Spengler

Method Summary

void
addIndexField(String indexFieldName)
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).
GenClassRef
createGenClassRef(String genClassRefName)
Creates a new GenClassRef object.
ScalarField
createHiddenField(String fieldName, PType type, int size, int scale)
Create a new hidden field for the refgenclass.
NameDef
createIdNameDef()
Creates a new NameDef object for the new GenClassRef object.
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).
ClassRef
getClassRef()
Returns the ClassRef object which defines the current GenClassRef object.
String
getGenClassId()
Returns the id of the GenClass object.
String
getGenClassName()
Returns the name of the GenClass object.
GenClassRef
getGenClassRef()
Returns the GenClassRef object which defines the current GenClassRef object.
ScalarField
getHiddenField(String fieldName)
retrieve an hiddenfield from its name.
Collection
getHiddenFields()
return the collection of the hiddenfield of the refgenclass definition.
Collection
getIdNameDef()
Returns an iterator on existing NameDef of GenClassRef object.
NameDef
getIdNameDef(String projectName)
Returns a NameDef object.
Collection
getIndexFields()
Allows to know all the existing index field for the current generic class.
PrimitiveElement
getPrimitiveElement()
Returns the PrimitiveElement object which defines the current GenClassRef object.
boolean
isClassRef()
Allows to know if the current object is a reference to a Class or not.
boolean
isGenClassRef()
Allows to know if the current object is a reference to a generic class or not.
boolean
isPrimitive()
Allows to know if the current object is primitive or not (final and "basic").
TypedElement
removeTypedElement(String fieldName)
Removes the primitive element.

Methods inherited from interface org.objectweb.jorm.metainfo.api.MetaObject

getParent, setParent

Methods inherited from interface org.objectweb.jorm.metainfo.api.Reference

createRefNameDef, getRefNameDef, getRefNameDef

Methods inherited from interface org.objectweb.jorm.metainfo.api.TypedElement

getName, getType

Method Details

addIndexField

public void addIndexField(String indexFieldName)

Parameters:
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).

Parameters:
clazz - the reference to the Class object which defines the current GenClassRef object. This object is the final object of the recursion.

Returns:
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).

Parameters:
genClassRefName - the name of the generic class used to create a new GenClassRef object

Returns:
a new GenClassRef object


createHiddenField

public ScalarField createHiddenField(String fieldName,
                                     PType type,
                                     int size,
                                     int scale)
Create a new hidden field for the refgenclass.

Returns:
the ScalarField


createIdNameDef

public NameDef createIdNameDef()
Creates a new NameDef object for the new GenClassRef object.

Returns:
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).

Parameters:
type - is the PType of the primitive element which will be created

Returns:
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.

Returns:
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", ..)

Returns:
the id of the GenClassRef object


getGenClassName

public String getGenClassName()
Returns the name of the GenClass object. ("Set", ..)

Returns:
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.

Returns:
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.

Returns:
the hiddenfield.


getHiddenFields

public Collection getHiddenFields()
return the collection of the hiddenfield of the refgenclass definition.

Returns:
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.

Returns:
an iterator on NameDef object


getIdNameDef

public NameDef getIdNameDef(String projectName)
Returns a NameDef object. If the namedef does not exist, null is returned.

Parameters:
projectName - the name of the project.

Returns:
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.

Returns:
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.

Returns:
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.

Returns:
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.

Returns:
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").

Returns:
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.

Parameters:
fieldName - is the name of the field to be removed

Returns:
the removed primitive element.