org.objectweb.medor.query.jorm.lib
Class PNameField

java.lang.Object
  |
  +--org.objectweb.medor.query.jorm.lib.PNameField
All Implemented Interfaces:
Cloneable, java.lang.Cloneable, Field, JormField, QueryTreeField

public class PNameField
extends java.lang.Object
implements QueryTreeField, JormField

This class represents Fields corresponding to the PName of a class or a Genclass(the NameDef of the class itself) or the the PName associated to a reference field or to a genclass element. The name of such a Field is a constant.

Author:
Alexandre Lefebvre, Sebastien Chassande-Barrioz

Field Summary
protected  java.lang.Class clazz
          In case where this PNameField represents the PName of a Jorm class, this field is not null and references the Jorm Meta object Class.
protected  java.lang.String fieldName
          Name of the field.
protected  boolean isClassPName
          If the current PNameField represents a PName of a Jorm class or genclass, this field is equals to 'true'.
protected  boolean isInGenClass
          This fiedl returns 'true' if the current PNameField has been built to describe the PName identifier of a GenClass or the PName of the GenClass element.
protected  QueryTree queryTree
           
protected  Reference reference
          In case where this PNameField represents the a reference field, this field is not null and references the Jorm Meta object Reference.
protected  PType type
          Type of the field
protected  short valueState
           
 
Fields inherited from interface org.objectweb.medor.api.Field
NONULLS, NULLABLE, NULLABLEUNKNOWN, PNAMENAME
 
Constructor Summary
PNameField(java.lang.String fieldName, ClassRef cr, QueryTree qt)
          This constructor must be used to built a PNameField associated to a classRef.
PNameField(java.lang.String fieldName, GenClassRef gcr, boolean isGenClassPName, QueryTree qt)
          This constructor must be used to built a PNameField associated to a GenClass identifier or the genclass element.
 
Method Summary
 java.lang.Object clone()
           
 GenClassRef getGenClassRef()
          It returns the jorm meta object GenClassRef in case of this PNameField represents a GenClass identifier or a GenClass element.
 java.lang.Class getMetaObjectClass()
          It returns the jorm meta object Class in case of this PNameField represents an identifier of a jorm class.
 java.lang.String getName()
          It returns the field name of the PNameField
 NameDef getNameDef(JormExtent extent)
          Retrieves the NameDef corresponding to this PNameField
 short getNullStatus()
          What is the status of the Field regarding null values (NullStatus).
 java.lang.String getPNamingContextParameter()
          Retrieves the name of the ParameterOperand containing the PNamingContext.
 QueryTree getQueryTree()
          It returns the QueryTree whith which this QueryTreeField is associated.
 Reference getReference()
          It returns the jorm meta object Reference in case of this PNameField represents a reference field in a jorm class.
 MetaObject getTargetedMetaObject()
          Retrieves the Jorm meta object of the Class represented by this PNameField.
 PType getType()
          It returns the type of the field.
 TypedElement getTypedElement()
          Returns the JORM meta object corresponding to the JORM Field.
 boolean isClassPName()
          It returns 'true' when this PNameField represents the identifier of a jorm class or a jorm genclass.
 boolean isInGenClass()
          It returns 'true' if the current PNameField has been built to describe the PName identifier of a GenClass or the PName of the GenClass element.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clazz

protected java.lang.Class clazz
In case where this PNameField represents the PName of a Jorm class, this field is not null and references the Jorm Meta object Class.


reference

protected Reference reference
In case where this PNameField represents the a reference field, this field is not null and references the Jorm Meta object Reference.


isClassPName

protected boolean isClassPName
If the current PNameField represents a PName of a Jorm class or genclass, this field is equals to 'true'. Otherwise the current PNameField represents a reference field or the genclass element then this field is equals to 'false'.


isInGenClass

protected boolean isInGenClass
This fiedl returns 'true' if the current PNameField has been built to describe the PName identifier of a GenClass or the PName of the GenClass element.


type

protected PType type
Type of the field


valueState

protected short valueState

fieldName

protected java.lang.String fieldName
Name of the field.


queryTree

protected QueryTree queryTree
Constructor Detail

PNameField

public PNameField(java.lang.String fieldName,
                  GenClassRef gcr,
                  boolean isGenClassPName,
                  QueryTree qt)
This constructor must be used to built a PNameField associated to a GenClass identifier or the genclass element.

Parameters:
fieldName - is the name which must be given to the field.
gcr - is the jorm meta object which describes the genclass.
isGenClassPName - indicates if this PNameField will represent a genclass identifier(value='true'). Otherwise the this PNameField will represent a genclass element(value='false').
qt - is the QueryTree which is associated to this QueryTree field.

PNameField

public PNameField(java.lang.String fieldName,
                  ClassRef cr,
                  QueryTree qt)
           throws MedorException
This constructor must be used to built a PNameField associated to a classRef.

Parameters:
cr - is the jorm meta object ClassRef associated to this PNameField.
qt - is the QueryTree which is associated to this QueryTree field.
Method Detail

getType

public PType getType()
It returns the type of the field. The type has been calculated a building time.

Specified by:
getType in interface Field
Returns:
the Field type

getNullStatus

public short getNullStatus()
Description copied from interface: Field
What is the status of the Field regarding null values (NullStatus).

Specified by:
getNullStatus in interface Field
Returns:
the Null status of the Field
See Also:
NullStatus

clone

public java.lang.Object clone()
Specified by:
clone in interface Cloneable
Overrides:
clone in class java.lang.Object

getName

public java.lang.String getName()
It returns the field name of the PNameField

Specified by:
getName in interface Field
Returns:
the Field name

isClassPName

public boolean isClassPName()
It returns 'true' when this PNameField represents the identifier of a jorm class or a jorm genclass.


getReference

public Reference getReference()
It returns the jorm meta object Reference in case of this PNameField represents a reference field in a jorm class.


getMetaObjectClass

public java.lang.Class getMetaObjectClass()
It returns the jorm meta object Class in case of this PNameField represents an identifier of a jorm class.


getGenClassRef

public GenClassRef getGenClassRef()
It returns the jorm meta object GenClassRef in case of this PNameField represents a GenClass identifier or a GenClass element.


getQueryTree

public QueryTree getQueryTree()
It returns the QueryTree whith which this QueryTreeField is associated.

Specified by:
getQueryTree in interface QueryTreeField

isInGenClass

public boolean isInGenClass()
It returns 'true' if the current PNameField has been built to describe the PName identifier of a GenClass or the PName of the GenClass element.


getTypedElement

public TypedElement getTypedElement()
Description copied from interface: JormField
Returns the JORM meta object corresponding to the JORM Field.

Specified by:
getTypedElement in interface JormField
Returns:
the JORM meta object corresponding to the JORM Field, as a TypedElement.

getNameDef

public NameDef getNameDef(JormExtent extent)
                   throws MedorException
Retrieves the NameDef corresponding to this PNameField

Parameters:
extent - attached to this PNameField
Throws:
MedorException - if it is not possible to fetch the Mapping for the project name and the mapper attached to the JormExtent.

getPNamingContextParameter

public java.lang.String getPNamingContextParameter()
Retrieves the name of the ParameterOperand containing the PNamingContext.


getTargetedMetaObject

public MetaObject getTargetedMetaObject()
Retrieves the Jorm meta object of the Class represented by this PNameField. If the parameter is a Class then the same value is returned. If the parameter is a ClassRef or a GenClassRef then referenced Class is returned. Otherwise a null value is returned.