org.objectweb.jorm.metainfo.lib
Class BasicPrimitiveElement

java.lang.Object
  |
  +--org.objectweb.jorm.metainfo.lib.BasicPrimitiveElement
All Implemented Interfaces:
Loggable, MetaObject, PrimitiveElement, java.io.Serializable, TypedElement
Direct Known Subclasses:
BasicScalarField

public class BasicPrimitiveElement
extends java.lang.Object
implements PrimitiveElement, Loggable

The BasicPrimitiveElement object is used to define fields which are primitive types. This object is defined by its name, its type, its parent, its size (if used) and a list of mappings for the field.

Author:
X. Spengler
See Also:
Serialized Form

Constructor Summary
BasicPrimitiveElement(java.lang.String name, PType type, MetaObject parent)
          Builds a new PrimitiveElement object.
 
Method Summary
 ValueMapping createValueMapping(java.lang.String mapperName, java.lang.String mappingName)
          Creates a new ValueMapping object for the current element.
 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.lang.String getName()
          Returns the name of the current typed element.
 MetaObject getParent()
          Allows to know the parent MetaObject of the current MetaObject.
 PType getType()
          Allows to know the type of the field.
 ValueMapping getValueMapping(java.lang.String mapperName, java.lang.String mappingName)
          Returns a ValueMapping object for the current element object.
 boolean isScalar()
          Allows to know if the current Field is a scalar field or not.
 java.util.Iterator iterateValueMapping()
          Allows to know all the ValueMapping object used for the current element.
 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 setParent(MetaObject itsParent)
          Set the parent of the current meta object if it is not yet done by the constructor of the meta object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicPrimitiveElement

public BasicPrimitiveElement(java.lang.String name,
                             PType type,
                             MetaObject parent)
Builds a new PrimitiveElement object. This object is mainly defined by its name, its type and its parent.
Parameters:
name - the name of the primitive field
type - the type of the field (PType object)
parent - the parent of the current object
Method Detail

isScalar

public boolean isScalar()
Allows to know if the current Field is a scalar field or not.
Specified by:
isScalar in interface PrimitiveElement
Returns:
true, if the Field is scalar, else false, if the Field is not scalar

getValueMapping

public ValueMapping getValueMapping(java.lang.String mapperName,
                                    java.lang.String mappingName)
Returns a ValueMapping object for the current element object. If the corresponding object does not exist, null is returned.
Specified by:
getValueMapping in interface PrimitiveElement
Parameters:
mapperName - the name of the mapping element name
mappingName - the name of the mapping name
Returns:
a ValueMapping object. If there is no value mapping object, null is returned.

createValueMapping

public ValueMapping createValueMapping(java.lang.String mapperName,
                                       java.lang.String mappingName)
Creates a new ValueMapping object for the current element. This mapping is defined by the name of the mapper, and the name of the mapping. If the object already exists, it is returned.
Specified by:
createValueMapping in interface PrimitiveElement
Parameters:
mapperName - the name of the mapper name
mappingName - the name of the mapping name
Returns:
a new ValueMapping object. This object is dependent from the mapper.

iterateValueMapping

public java.util.Iterator iterateValueMapping()
Allows to know all the ValueMapping object used for the current element.
Specified by:
iterateValueMapping in interface PrimitiveElement
Returns:
an iterator object on ValueMapping object. If no ValueMapping is declared, an empty iterator is returned.

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

getName

public java.lang.String getName()
Returns the name of the current typed element.
Specified by:
getName in interface TypedElement
Returns:
the string representation of the typed element

getType

public PType getType()
Allows to know the type of the field.
Specified by:
getType in interface TypedElement
Returns:
a PType object which defines the type of the current field

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