org.objectweb.jorm.metainfo.api
Interface GenClassRef

All Superinterfaces:
MetaObject, Reference, java.io.Serializable, TypedElement
All Known Implementing Classes:
BasicGenClassRef

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
 ClassMapping createClassMapping(java.lang.String mapperName, java.lang.String mappingName)
          Creates a new ClassMapping object for the current reference.
 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)
          Create a new hidden field for the refgenclass.
 PrimitiveElement createPrimitiveElement(PType type)
          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).
 NameDef createRefNameDef()
          Creates a new NameDef object for the new GenClassRef object.
 ClassMapping getClassMapping(java.lang.String mapperName, java.lang.String mappingName)
          Returns an existing ClassMapping object for the current reference object from a given mapper name and mapping name.
 ClassRef getClassRef()
          Returns the ClassRef object which defines the current GenClassRef object.
 GenClass getGenClass()
          Returns the underlying GenClass object which describes the generic class object used.
 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.
 PrimitiveElement getPrimitiveElement()
          Returns the PrimitiveElement object which defines the current GenClassRef object.
 NameDef getRefNameDef(java.lang.String mappingName)
          Returns a NameDef object from a given mapperName and mappingName.
 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").
 java.util.Iterator iterateClassMapping()
          Allows to know all the ClassMapping objects used for the current reference.
 java.util.Iterator iterateHiddenField()
          return an iterator over the hiddenfield of the refgenclass definition.
 java.util.Iterator iterateRefNameDef()
          Returns an iterator on existing NameDef of GenClassRef object.
 
Methods inherited from interface org.objectweb.jorm.metainfo.api.Reference
createNameDef, getNameDef, iterateNameDef
 
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)
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.

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

createRefNameDef

public NameDef createRefNameDef()
Creates a new NameDef object for the new GenClassRef object. If the specified namedef object already exists, it is returned, else a new NameDef object is created.
Parameters:
nameDefName - the name of the nameDef read in the persistence description file
isSystem - true, the namedef is defined outside jorm, else false, the namedef is define inside jorm
Returns:
a new object used to describe the PName projection for the current Class, or an existing object if already defined

iterateRefNameDef

public java.util.Iterator iterateRefNameDef()
Returns an iterator on existing NameDef of GenClassRef object. If no NameDef exists, an empty iterator is returned.
Returns:
an iterator on NameDef object

getRefNameDef

public NameDef getRefNameDef(java.lang.String mappingName)
Returns a NameDef object from a given mapperName and mappingName. If the corresponding NameDef does not exist, null is returned.
Parameters:
mapperName - the name of the mapper
mappingName - the name of the mapping
Returns:
an existing namedef object if exists, either null

getGenClass

public GenClass getGenClass()
Returns the underlying GenClass object which describes the generic class object used.
Returns:
the underlying generic class object

getClassMapping

public ClassMapping getClassMapping(java.lang.String mapperName,
                                    java.lang.String mappingName)
Returns an existing ClassMapping object for the current reference object from a given mapper name and mapping name.
Parameters:
mapperName - the name of the mapper reference name
mappingName - the name of the mapping reference name
Returns:
a ClassMapping object. If the ClassMapping does not exist for the mapper, null is returned.

createClassMapping

public ClassMapping createClassMapping(java.lang.String mapperName,
                                       java.lang.String mappingName)
Creates a new ClassMapping object for the current reference. This mapping is defined by the name of the mapper, and the name of the mapping.
Parameters:
mapperName - the name of the reference mapper
mappingName - the name of the reference mapping
Returns:
a new ClassMapping object. This object is dependent from the mapper.

iterateClassMapping

public java.util.Iterator iterateClassMapping()
Allows to know all the ClassMapping objects used for the current reference. If no ClassMapping is defined, an empty iterator is returned.
Returns:
an iterator object on ClassMapping object. If there is no object, null is returned.

getGenClassName

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

createHiddenField

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

iterateHiddenField

public java.util.Iterator iterateHiddenField()
return an iterator over the hiddenfield of the refgenclass definition.

getHiddenField

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