org.objectweb.jorm.metainfo.lib
Class BasicPrimitiveElement

java.lang.Object
  extended byorg.objectweb.jorm.metainfo.lib.BasicMetaObject
      extended byorg.objectweb.jorm.metainfo.lib.BasicTypedElement
          extended byorg.objectweb.jorm.metainfo.lib.BasicPrimitiveElement
All Implemented Interfaces:
java.lang.Comparable, Loggable, MetaObject, PrimitiveElement, java.io.Serializable, TypedElement
Direct Known Subclasses:
BasicScalarField

public class BasicPrimitiveElement
extends BasicTypedElement
implements PrimitiveElement

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

Field Summary
 
Fields inherited from class org.objectweb.jorm.metainfo.lib.BasicMetaObject
debug, logger, loggerFactory, parent
 
Fields inherited from interface org.objectweb.jorm.metainfo.api.PrimitiveElement
CONSTANT_NON_PERSISTENT, CONSTANT_PERSISTENT, VARIABLE_PERSISTENT
 
Constructor Summary
BasicPrimitiveElement(java.lang.String name, PType type, int size, int scale, MetaObject parent)
          Builds a new PrimitiveElement object.
 
Method Summary
 int getScale()
           
 int getSize()
          Returns the size of the field in case of string, serialized, arrays, etc
 int getStatus()
          Gets the status wrt constance and persistence.
 boolean isAutoCalculated()
          Indicate if the primitive element is auto calculated.
 boolean isConstant()
           
 boolean isPersistent()
           
 boolean isScalar()
          Allows to know if the current Field is a scalar field or not.
 void setIsAutoCalculated(boolean autocalculated)
           
 void setStatus(int status)
          Assigns the status indicating if the primitive element is one of: variable and persistent (classical case) constant and persistent constant and not persistent
 
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicTypedElement
compareTo, getName, getType
 
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicMetaObject
getChildren, getLogger, getLoggerFactory, getManager, getParent, setLogger, setLoggerFactory, setLoggingOnChild, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jorm.metainfo.api.TypedElement
getName, getType
 
Methods inherited from interface org.objectweb.jorm.metainfo.api.MetaObject
getParent, setParent
 

Constructor Detail

BasicPrimitiveElement

public BasicPrimitiveElement(java.lang.String name,
                             PType type,
                             int size,
                             int scale,
                             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

getSize

public int getSize()
Returns the size of the field in case of string, serialized, arrays, etc

Specified by:
getSize in interface PrimitiveElement
Returns:
the size for this type

getScale

public int getScale()
Specified by:
getScale in interface PrimitiveElement

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

isAutoCalculated

public boolean isAutoCalculated()
Description copied from interface: PrimitiveElement
Indicate if the primitive element is auto calculated. In case of a CompositeName, an auto calculated field means that the value is calculated by an external tool. In case of a class, an auto calculated field means that the value is calculated by the data support (auto increment value for instance).

Specified by:
isAutoCalculated in interface PrimitiveElement

setIsAutoCalculated

public void setIsAutoCalculated(boolean autocalculated)
Specified by:
setIsAutoCalculated in interface PrimitiveElement
See Also:
this.isAutoCalculated()

getStatus

public int getStatus()
Description copied from interface: PrimitiveElement
Gets the status wrt constance and persistence.

Specified by:
getStatus in interface PrimitiveElement
See Also:
this.setStatus()

setStatus

public void setStatus(int status)
Description copied from interface: PrimitiveElement
Assigns the status indicating if the primitive element is one of:

Specified by:
setStatus in interface PrimitiveElement

isConstant

public boolean isConstant()
Specified by:
isConstant in interface PrimitiveElement
Returns:
true if the field is constant

isPersistent

public boolean isPersistent()
Specified by:
isPersistent in interface PrimitiveElement
Returns:
true if the field is persistent