org.objectweb.jorm.metainfo.api
Interface Class

All Superinterfaces:
MetaObject, java.io.Serializable

public interface Class
extends MetaObject

A Class interface defines methods to describe a Class meta object. A Class is composed by a set of fields (primitive, reference class or reference generic class), a set of inherited classes, a mapping class, can be abstract or not and has a name.

Author:
X. Spengler

Method Summary
 void addAllInheritedClass(java.util.Map table)
          Constructs an Hashtable with inherited class
 void addClassProject(java.lang.String projectName, ClassProject classProject)
          Adds a ClassProject object.
 Extension addInheritedClass(Class class_)
          Adds a new inherited class to the list of the inherited classes for the current class object.
 ClassProject createClassProject(java.lang.String projectName)
          Creates a new ClassProject object.
 ClassRef createClassRef(java.lang.String fieldName, Class class_)
          Allows to obtain a new ClassRef from a field name an its class.
 GenClassRef createGenClassRef(java.lang.String fieldName, java.lang.String genName)
          Allows to obtain a new GenClassRef from a field name an its generic class.
 ScalarField createHiddenField(java.lang.String fieldname, PType type, int size)
          Creates an hiddenfield for the current Class object.
 NameDef createNameDef()
          Creates a new NameDef object for the current Class object.
 PrimitiveElement createPrimitiveElement(java.lang.String fieldName, PType type, int size)
          Allows to obtain a new PrimitiveElement from a class field name an its type.
 ClassProject getClassProject(java.lang.String projectName)
          Returns a ClassProject object.
 java.util.Collection getClassProjects()
          Returns a collection of ClassProject objects.
 Extension getExtension(java.lang.String fqcn)
          Returns an Extension object.
 java.util.Collection getExtensions()
          Returns a collection of Extension objects.
 int getFieldRefNumber()
          Returns the number of fields which are references to classes.
 java.lang.String getFileName()
          Allows to retrieve the file name of this class MO.
 java.lang.String getFQName()
          Gets the fully qualified name (including the package name) associated with this class.
 ScalarField getHiddenField(java.lang.String fieldname)
          Retrieve the hiddenfield identified by its name in the current class.
 int getInheritedClassNumber()
          Returns the number of inherited classes for the current Class object.
 java.lang.String getName()
          Allows to know the name of the current class object.
 NameDef getNameDef(java.lang.String projectName)
          Returns a NameDef object from a given mapperName and mappingName.
 TypedElement getTypedElement(java.lang.String fieldName)
          Allows to obtain an existing Field.
 boolean isAbstract()
          Allows to know if the current class is an abstract class or not.
 boolean isInherited()
          Tests if this class is inherited by another one.
 java.util.Iterator iterateAllField()
          Returns an iterator on existing class fields + fields from super classes.
 java.util.Iterator iterateAllHiddenField()
          Provides an iterator over the all the hiddenfield of the class including inherited fields.
 java.util.Iterator iterateExtension()
          Allows us to obtain all the Extension objects from the current class object.
 java.util.Iterator iterateField()
          Returns an iterator on existing class fields.
 java.util.Iterator iterateHiddenField()
          Provides an iterator over the all the hiddenfield of the class excluding inherited fields.
 java.util.Iterator iterateInheritedClass()
          Allows us to obtain all the inherited classes from the current class object.
 java.util.Iterator iterateNameDef()
          Returns an iterator on existing NameDef for the current Class.
 ClassProject removeClassProject(java.lang.String projectname)
          Removes a ClassProject instance.
 TypedElement removeTypedElement(java.lang.String fieldName)
          Removes a typed element.
 void setAbstract(boolean isAbstract)
           
 void setFileName(java.lang.String filename)
          Allows to assign the file name of this class MO.
 void setInherited()
          Specifies that this class is inherited by another one within the set of compiled ones.
 
Methods inherited from interface org.objectweb.jorm.metainfo.api.MetaObject
getParent, setParent
 

Method Detail

getFileName

public java.lang.String getFileName()
Allows to retrieve the file name of this class MO.

Returns:
The file name.

setFileName

public void setFileName(java.lang.String filename)
Allows to assign the file name of this class MO.

Parameters:
filename - The file name.

isAbstract

public boolean isAbstract()
Allows to know if the current class is an abstract class or not.

Returns:
true, if the current class is an abstract class, and false, if the current class is not abstract

setAbstract

public void setAbstract(boolean isAbstract)

getName

public java.lang.String getName()
Allows to know the name of the current class object.

Returns:
the string representation of the class name

getFQName

public java.lang.String getFQName()
Gets the fully qualified name (including the package name) associated with this class.

Returns:
the string representation of the fully qualified class name

getTypedElement

public TypedElement getTypedElement(java.lang.String fieldName)
Allows to obtain an existing Field. A TypedElement is a class field, and this method finds a field with its name (fieldName). This method is a generic method to return a TypedElement object.

Parameters:
fieldName - the name of the class field
Returns:
a field object. If the field does not exist, null is returned.

removeTypedElement

public TypedElement removeTypedElement(java.lang.String fieldName)
Removes a typed element.

Parameters:
fieldName - is the name of the field to be removed
Returns:
the removed element or null if the field has not been found.

createNameDef

public NameDef createNameDef()
Creates a new NameDef object for the current Class object. Here we can define if the namedef is defined outside jorm or not. In the case where the namedef is already defined for the current class, the old one is used and returned. associated.

Returns:
a new object used to describe the PName projection for the current Class

createHiddenField

public ScalarField createHiddenField(java.lang.String fieldname,
                                     PType type,
                                     int size)
Creates an hiddenfield for the current Class object. An hidden field is used to map the pname of the class or the pname of a ref field. An hidden field is a scalarfield.

Parameters:
fieldname - the name of the hiddenfield
type - the ptype of the hiddenfield
Returns:
a new scalarfield object used to describe the hiddenfield

iterateAllHiddenField

public java.util.Iterator iterateAllHiddenField()
Provides an iterator over the all the hiddenfield of the class including inherited fields.

Returns:
the iterator embeding scalarfield object describing the hiddenfields.

iterateHiddenField

public java.util.Iterator iterateHiddenField()
Provides an iterator over the all the hiddenfield of the class excluding inherited fields.

Returns:
the iterator embeding scalarfield object describing the hiddenfields.

getHiddenField

public ScalarField getHiddenField(java.lang.String fieldname)
Retrieve the hiddenfield identified by its name in the current class.

Parameters:
fieldname - the name of the hiddenfield.
Returns:
the scalarfield object describing the hiddenfield or null if the field does not exist in the class.

iterateNameDef

public java.util.Iterator iterateNameDef()
Returns an iterator on existing NameDef for the current Class. This method returns an empty iterator if no namedef exists in this Class.

Returns:
an iterator on NameDef, or an empty iterator if no namedef is defined

getNameDef

public NameDef getNameDef(java.lang.String projectName)
Returns a NameDef object from a given mapperName and mappingName. If the namedef does not exist, null is returned.

Parameters:
projectName - the name of the class project
Returns:
an existing namedef object if exists, either null

createPrimitiveElement

public PrimitiveElement createPrimitiveElement(java.lang.String fieldName,
                                               PType type,
                                               int size)
Allows to obtain a new PrimitiveElement from a class field name an its type. A PrimitiveElement is a Class field. If the class field already exists, it is returned.

Parameters:
fieldName - the name of the primitive field
type - the PType of the primitive field
Returns:
a new PrimitiveElement object, or the existing one if already defined

createClassRef

public ClassRef createClassRef(java.lang.String fieldName,
                               Class class_)
Allows to obtain a new ClassRef from a field name an its class. A ClassRef object is a field which is represented by a reference to a Class. If the field already exists, it is returned.

Parameters:
fieldName - the name of the field
class_ - the class meta-object which represents the reference of the field
Returns:
a new ClassRef object, or the existing one if already defined

createGenClassRef

public GenClassRef createGenClassRef(java.lang.String fieldName,
                                     java.lang.String genName)
Allows to obtain a new GenClassRef from a field name an its generic class. A GenClassRef object is a field which is represented by a reference to a generic class. If the field already exists, it is returned.

Parameters:
fieldName - the name of the field
genName - the GenClass object which represents the reference of the field
Returns:
a new GenClassRef object, or the existing one if already defined

iterateField

public java.util.Iterator iterateField()
Returns an iterator on existing class fields. If no field is defined, an empty iterator is returned. This iterator contains PrimitiveElements, ClassRef and GenClassRef objects. The top level object is TypedElement.

Returns:
an iterator on fields, or null if there is no defined field

iterateAllField

public java.util.Iterator iterateAllField()
Returns an iterator on existing class fields + fields from super classes. This iterator contains PrimitiveElement, ClassRef and GenClassRef objects.

Returns:
an iterator on all defined fields, plus fields from super

iterateInheritedClass

public java.util.Iterator iterateInheritedClass()
Allows us to obtain all the inherited classes from the current class object. This iterator contains Class objects. In the case where there is no inherited class, an empty iterator is returned.

Returns:
an iterator on inherited classes (Class objets). If no object exists, an empty iterator is returned.

iterateExtension

public java.util.Iterator iterateExtension()
Allows us to obtain all the Extension objects from the current class object. If there is no Extension object, an empty iterator is returned.

Returns:
an iterator on Extension classes. If no object exists, an empty iterator is returned.

getExtensions

public java.util.Collection getExtensions()
Returns a collection of Extension objects.

Returns:
a collection.

getExtension

public Extension getExtension(java.lang.String fqcn)
Returns an Extension object.

Parameters:
fqcn - a full qualified class name.
Returns:
an Extension object.

addInheritedClass

public Extension addInheritedClass(Class class_)
Adds a new inherited class to the list of the inherited classes for the current class object. If the class already exists, nothing is done.

Parameters:
class_ - the inherited class to add to inherited classes list
Returns:
an Extension object.

getInheritedClassNumber

public int getInheritedClassNumber()
Returns the number of inherited classes for the current Class object.

Returns:
the number of inherited classes

addAllInheritedClass

public void addAllInheritedClass(java.util.Map table)
Constructs an Hashtable with inherited class

Parameters:
table - the hashtable to build

getFieldRefNumber

public int getFieldRefNumber()
Returns the number of fields which are references to classes.

Returns:
the number of fieldRef

setInherited

public void setInherited()
Specifies that this class is inherited by another one within the set of compiled ones.


isInherited

public boolean isInherited()
Tests if this class is inherited by another one.


getClassProject

public ClassProject getClassProject(java.lang.String projectName)
Returns a ClassProject object.

Parameters:
projectName - a project name.
Returns:
a ClassProject object.

getClassProjects

public java.util.Collection getClassProjects()
Returns a collection of ClassProject objects.

Returns:
a collection.

addClassProject

public void addClassProject(java.lang.String projectName,
                            ClassProject classProject)
Adds a ClassProject object.

Parameters:
projectName - a project name, classProject a ClassProject object.

createClassProject

public ClassProject createClassProject(java.lang.String projectName)
Creates a new ClassProject object.

Parameters:
projectName - the name of the project.
Returns:
a new ClassProject object, or an existing one.

removeClassProject

public ClassProject removeClassProject(java.lang.String projectname)
Removes a ClassProject instance.

Parameters:
projectname - is the name of removed ClassProject
Returns:
The removed ClassProject