org.objectweb.jorm.metainfo.api
Interface GenClassRef

All Superinterfaces:
MetaObject, Reference, java.io.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(java.lang.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(java.lang.String genClassRefName)
          Creates a new GenClassRef object.
 ScalarField createHiddenField(java.lang.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.
 java.lang.String getGenClassId()
          Returns the id of the GenClass object.
 java.lang.String getGenClassName()
          Returns the name of the GenClass object.
 GenClassRef getGenClassRef()
          Returns the GenClassRef object which defines the current GenClassRef object.
 ScalarField getHiddenField(java.lang.String fieldName)
          retrieve an hiddenfield from its name.
 java.util.Collection getHiddenFields()
          return the collection of the hiddenfield of the refgenclass definition.
 java.util.Collection getIdNameDef()
          Returns an iterator on existing NameDef of GenClassRef object.
 NameDef getIdNameDef(java.lang.String projectName)
          Returns a NameDef object.
 java.util.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(java.lang.String fieldName)
          Removes the primitive element.
 
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
 
Methods inherited from interface org.objectweb.jorm.metainfo.api.MetaObject
getParent, setParent
 

Method Detail

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.

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(java.lang.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

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.

removeTypedElement

public TypedElement removeTypedElement(java.lang.String fieldName)
Removes the primitive element.

Parameters:
fieldName - is the name of the field to be removed
Returns:
the removed primitive element.

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.

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.

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

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

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

getIdNameDef

public java.util.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(java.lang.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.

getGenClassName

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

Returns:
the name of the GenClassRef object

getGenClassId

public java.lang.String getGenClassId()
Returns the id of the GenClass object. ("Set/List/String", ..)

Returns:
the id of the GenClassRef object

createHiddenField

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

Returns:
the ScalarField

getHiddenFields

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

Returns:
the collection containing the hiddenfield (ScalarField).

getHiddenField

public ScalarField getHiddenField(java.lang.String fieldName)
retrieve an hiddenfield from its name.

Returns:
the hiddenfield.

addIndexField

public void addIndexField(java.lang.String indexFieldName)
Parameters:
indexFieldName - the name of the index field

getIndexFields

public java.util.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.