org.objectweb.jorm.metainfo.lib
Class BasicNameDef

java.lang.Object
  |
  +--org.objectweb.jorm.metainfo.lib.BasicNameDef
All Implemented Interfaces:
Loggable, MetaObject, NameDef, java.io.Serializable

public class BasicNameDef
extends java.lang.Object
implements NameDef, Loggable

The BasicNameDef object describes the mapping of a reference field, It can be the PName of a Class. It can be a Field which is an attribute of the class and is a reference; in this case, the reference can be to another Class (ClassObject) or to a GenClass.

Author:
X. Spengler
See Also:
Serialized Form

Constructor Summary
BasicNameDef(MetaObject parent)
          Builds a new BasicNameDef objects.
 
Method Summary
 boolean arePresents(java.lang.String mappingName)
          Verifies if the tuple mappingname is present in the current namedef object.
 NameRef createNameRef(java.lang.String name, CompositeName cn_Class)
          Build a reference toward a composite name describing the namedef.
 java.lang.String getFieldName()
          Retrieve the name of the field describing the namedef.
 int getFieldNumber()
          Returns the number of hidden fields which composed the current object.
 org.objectweb.util.monolog.api.Logger getLogger()
          Returns a logger to an component that wants to log things.
 org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
          Returns a logger factory that allows the creation of new loggers.
 java.util.Iterator getMappNames()
          Retrieve an iterator over the mapping name defined for this NameDef.
 NameRef getNameRef()
          Retrieves the nameref if the namedef is a composite one.
 MetaObject getParent()
          Allows to know the parent MetaObject of the current MetaObject.
 boolean isFieldName()
          allow to know if the namedef is describe by a single field.
 boolean isNameRef()
          allow to know if the namedef is describe by a composite name.
 boolean isSystem()
          Allows to know if the mapping of the referenced field is defined by another system (could be defined by Versant system for instance).
 java.util.Iterator iterateField()
          Returns an iterator on all fields (HiddenFields and FieldRef).
 void setFieldName(java.lang.String fieldname)
          Allow to set the fieldname describing the namedef single field.
 void setLogger(org.objectweb.util.monolog.api.Logger logger)
          Defines a logger object.
 void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory loggerFactory)
          Defines the logger factory to obtain new logger.
 void setMappNames(java.lang.String mappingName)
          Sets the names of the mapper and the mapping defined for this NameDef.
 void setParent(MetaObject itsParent)
          Set the parent of the current meta object if it is not yet done by the constructor of the meta object
 void setSystem(boolean system)
          Allows to set if the current NameDef is system defined (defined outside jorm) or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicNameDef

public BasicNameDef(MetaObject parent)
Builds a new BasicNameDef objects. This object is defined by its name, if it is defined outside jorm or not, and its parent.
Parameters:
name - the name of the name definition object
isSystem - if true, the name is defined outside jorm, else false, the name is defined by jorm
parent - the parent object of the current NameDef object
Method Detail

getFieldNumber

public int getFieldNumber()
Returns the number of hidden fields which composed the current object.
Specified by:
getFieldNumber in interface NameDef
Returns:
the number of hidden fields

isSystem

public boolean isSystem()
Allows to know if the mapping of the referenced field is defined by another system (could be defined by Versant system for instance).
Specified by:
isSystem in interface NameDef
Returns:
true, if the mapping is defined by another system, else false, if the mapping is defined inside JORM (by ScalarField(s) and FieldName(s)).

setSystem

public void setSystem(boolean system)
Allows to set if the current NameDef is system defined (defined outside jorm) or not.
Specified by:
setSystem in interface NameDef
Parameters:
system - true, if the mapping is defined by another system, else false, if the mapping is defined inside JORM (by ScalarField(s) and FieldName(s)).

isNameRef

public boolean isNameRef()
allow to know if the namedef is describe by a composite name.
Specified by:
isNameRef in interface NameDef
Returns:
true the namedef is a composite one.

isFieldName

public boolean isFieldName()
allow to know if the namedef is describe by a single field.
Specified by:
isFieldName in interface NameDef
Returns:
true the namedef is a single one.

createNameRef

public NameRef createNameRef(java.lang.String name,
                             CompositeName cn_Class)
Build a reference toward a composite name describing the namedef.
Specified by:
createNameRef in interface NameDef
Parameters:
name - the name of the compsoite name
cn_Class - the meta object representing the composite name.
Returns:
the nameref metaobject describing the reference.

getNameRef

public NameRef getNameRef()
Retrieves the nameref if the namedef is a composite one.
Specified by:
getNameRef in interface NameDef
Returns:
the nameref or null if the namedef is a single one or system.

getMappNames

public java.util.Iterator getMappNames()
Retrieve an iterator over the mapping name defined for this NameDef.
Specified by:
getMappNames in interface NameDef
Returns:
an iterator containing the mapping name as string.

getFieldName

public java.lang.String getFieldName()
Retrieve the name of the field describing the namedef. The fieldname can be the name of a field or an hiddenfield.
Specified by:
getFieldName in interface NameDef
Returns:
the fieldname or null is the namedef is a system or a composite one.

setFieldName

public void setFieldName(java.lang.String fieldname)
Allow to set the fieldname describing the namedef single field.
Specified by:
setFieldName in interface NameDef
Parameters:
fieldname - the fieldname

iterateField

public java.util.Iterator iterateField()
Returns an iterator on all fields (HiddenFields and FieldRef). This iterator contains FieldName and ScalarField objects. If no object fields exists, an empty iterator is returned.
Specified by:
iterateField in interface NameDef
Returns:
an iterator on field

setMappNames

public void setMappNames(java.lang.String mappingName)
Sets the names of the mapper and the mapping defined for this NameDef. This method replaces two setters, which are not required because the two String are set in same time.
Specified by:
setMappNames in interface NameDef
Parameters:
mapperName - the name of the used mapper
mappingName - the name of the used mapping

arePresents

public boolean arePresents(java.lang.String mappingName)
Verifies if the tuple mappingname is present in the current namedef object. If the current NameDef supports the tuple, true is returned, else false.
Specified by:
arePresents in interface NameDef
Parameters:
mappingName - the name of the mapping
Returns:
true, if the tuple is present in the current NameDef, else false, if the tuple does not exist in the current NameDef

getParent

public MetaObject getParent()
Allows to know the parent MetaObject of the current MetaObject.
Specified by:
getParent in interface MetaObject
Returns:
the MetaObject corresponding to the parent of the current object. If there is no parent, null is returned.

setParent

public void setParent(MetaObject itsParent)
Set the parent of the current meta object if it is not yet done by the constructor of the meta object
Specified by:
setParent in interface MetaObject
Parameters:
itsParent - the parent MetaObject of the current object

setLogger

public void setLogger(org.objectweb.util.monolog.api.Logger logger)
Defines a logger object.
Specified by:
setLogger in interface Loggable
Parameters:
logger - the logger object

setLoggerFactory

public void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory loggerFactory)
Defines the logger factory to obtain new logger.
Specified by:
setLoggerFactory in interface Loggable
Parameters:
loggerFactory - the LoggerFactory object to obtain a logger object

getLogger

public org.objectweb.util.monolog.api.Logger getLogger()
Description copied from interface: Loggable
Returns a logger to an component that wants to log things.
Specified by:
getLogger in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
logger - the logger object

getLoggerFactory

public org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
Description copied from interface: Loggable
Returns a logger factory that allows the creation of new loggers.
Specified by:
getLoggerFactory in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
loggerfactory - the LoggerFactory object to obtain new loggers