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.
addClassProject
public void addClassProject(String projectName,
ClassProject classProject)
Adds a ClassProject object.
projectName
- a project name,
classProject a ClassProject object.
addSubClass
public void addSubClass(Class class_)
Adds a new class to the list of the derived classes for the
current class object.
If the class already exists, nothing is done.
class_
- the inherited class to add to inherited classes list
addSuperClass
public void addSuperClass(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.
class_
- the inherited class to add to inherited classes list
createClassProject
public ClassProject createClassProject(String projectName)
Creates a new ClassProject object.
projectName
- the name of the project.
- a new ClassProject object, or an existing one.
createClassRef
public ClassRef createClassRef(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.
fieldName
- the name of the fieldclass_
- the class meta-object which represents the reference of
the field
- a new ClassRef object, or the existing one if already defined
createGenClassRef
public GenClassRef createGenClassRef(String fieldName,
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.
fieldName
- the name of the fieldgenName
- the GenClass object which represents the reference of
the field
- a new GenClassRef object, or the existing one if already
defined
createHiddenField
public ScalarField createHiddenField(String fieldname,
PType type,
int size,
int scale)
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.
fieldname
- the name of the hiddenfieldtype
- the ptype of the hiddenfieldsize
- is the
- a new scalarfield object used to describe the hiddenfield
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.
- a new object used to describe the PName projection for
the current Class
createPrimitiveElement
public PrimitiveElement createPrimitiveElement(String fieldName,
PType type,
int size,
int scale)
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.
fieldName
- the name of the primitive fieldtype
- the PType of the primitive field
- a new PrimitiveElement object, or the existing one if already
defined
getAllFields
public Collection getAllFields()
Returns an iterator on existing class fields + fields from super classes.
This iterator contains PrimitiveElement, ClassRef and GenClassRef
objects.
- an iterator on all defined fields, plus fields from super
getAllHiddenFields
public Collection getAllHiddenFields()
- a collection of hidden field of the class including inherited
fields.
getAncestors
public List getAncestors()
getClassMapping
public ClassMapping getClassMapping(String projectName,
String mapperName)
Returns a ClassMapping object.
projectName
- a project name,
mappername a mapper name.
- a ClassMapping object.
getClassProject
public ClassProject getClassProject(String projectName)
Returns a ClassProject object.
projectName
- a project name.
- a ClassProject object.
getClassProjects
public Collection getClassProjects()
Returns a collection of ClassProject objects.
- a collection.
getConstantValue
public String getConstantValue(String fieldName)
Obtains the value of a constant PrimitiveElement, defined either in the
current class or in one of its ancestors.
The constant value is represented by a String.
fieldName
- the existing PrimitiveElement
- the constant value as a String
getFQName
public String getFQName()
Gets the fully qualified name (including the package name) associated
with this class.
- the string representation of the fully qualified class name
getFieldRefNumber
public int getFieldRefNumber()
Returns the number of fields which are references to classes.
- the number of fieldRef
getFields
public Collection getFields()
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.
- an iterator on fields, or null if there is no defined field
getFileName
public String getFileName()
Allows to retrieve the file name of this class MO.
- The file name.
getHiddenField
public ScalarField getHiddenField(String fieldname)
Retrieve the hiddenfield identified by its name in the current class.
fieldname
- the name of the hiddenfield.
- the scalarfield object describing the hiddenfield or null if the field does not exist in the class.
getHiddenFields
public Collection getHiddenFields()
- a collection of hidden field of the class WITHOUT inherited
fields.
getInheritanceFilter
public Expression getInheritanceFilter(NameDef nd)
throws ExpressionException
- the filter expression (Medor expression) permitting to known if
instance of the parent class is in fact an instance of the current
persistent class. The filter uses the field name (composite field in case
of a composite or the field class name). If the current class has no
parent, then this method return null;
getInheritanceNamingKey
public Object getInheritanceNamingKey(NameDef nd)
- the key matching to the current class. This value is the result
of the inheritance filter evaluation.
getInheritedClassNumber
public int getInheritedClassNumber()
Returns the number of inherited classes for the current Class object.
- the number of inherited classes
getName
public String getName()
Allows to know the name of the current class object.
- the string representation of the class name
getNameDef
public NameDef getNameDef(String projectName)
Returns a NameDef object from a given mapperName and mappingName.
If the namedef does not exist, null is returned.
projectName
- the name of the class project
- an existing namedef object if exists, either null
getNameDefs
public Collection getNameDefs()
- a collection of NameDef object
getPType
public PType getPType()
- the PType of the persistent class
getSubClasses
public Collection getSubClasses()
Allows us to obtain all classes derived from the current class object.
This collection contains Class objects. In the case where there is no
derived class, an empty collection is returned.
- a collection on derived classes (Class objets). If no object
exists, an empty collection is returned.
getSuperClass
public Class getSuperClass(String fqcn)
Retrieves a super class whith its name.
fqcn
- is the fully qualified class name of the super class
- a Class meta object instance if the specified class name is a
super class of the current class. A null value if the specified class name is
not a super class of the current class.
getSuperClasses
public Collection getSuperClasses()
Retrieves the collection of super classes
- a collection of Class meta objects.
getTypedElement
public TypedElement getTypedElement(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.
fieldName
- the name of the class field
- a field object. If the field does not exist, null is returned.
isAbstract
public boolean isAbstract()
Allows to know if the current class is an abstract class or not.
- true, if the current class is an abstract class, and false,
if the current class is not abstract
isPolymorphic
public boolean isPolymorphic()
Returns true if the class is polymorphic, i.e. it has subclasses or
superclasses
- true if the class is polymorphic
removeClassProject
public ClassProject removeClassProject(String projectname)
Removes a ClassProject instance.
projectname
- is the name of removed ClassProject
- The removed ClassProject
removeTypedElement
public TypedElement removeTypedElement(String fieldName)
Removes a typed element.
fieldName
- is the name of the field to be removed
- the removed element or null if the field has not been found.
setAbstract
public void setAbstract(boolean isAbstract)
setConstantValue
public void setConstantValue(String fieldName,
String cv)
Defines the value of a constant PrimitiveElement, defined either in the
current class or in one of its ancestors.
The constant value is represented by a String.
fieldName
- the existing PrimitiveElementcv
- the constant value
setFileName
public void setFileName(String filename)
Allows to assign the file name of this class MO.
filename
- The file name.
setInheritanceFilter
public void setInheritanceFilter(NameDef nd,
Expression filter)
filter
- is the filter expression (Medor expression) permitting to
known if instance of the parent class is in fact an instance of the
current persistent class. The filter uses the field name (composite field
in case of a composite or the field class name).
setInheritanceFilter
public void setInheritanceFilter(NameDef nd,
String filter)
filter
- is the filter expression (Medor expression as string)
permitting to known if instance of the parent class is in fact an
instance of the current persistent class. The filter uses the field name
(composite field in case of a composite or the field class name).
setInheritanceNamingKey
public void setInheritanceNamingKey(NameDef nd,
Object key)