org.objectweb.jorm.metainfo.lib
Class BasicGenClass

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

public class BasicGenClass
extends java.lang.Object
implements GenClass, Loggable

BasicGenClass is the implementation of the GenClass interface defined in the Meta information system. This object is defines by a name, a list of index fields, and its parent.

Author:
X. Spengler
See Also:
Serialized Form

Constructor Summary
BasicGenClass(java.lang.String name, boolean isAbstract, MetaObject parent)
          Builds a new BasicGenClass object.
 
Method Summary
 PrimitiveElement createIndexField(java.lang.String indexFieldName, PType type)
          Returns a new PrimitiveElement object, created with its name and its type (PType).
 PrimitiveElement getIndexField(java.lang.String indexFieldName)
          Returns the PrimitiveElement corresponding to its name.
 int getIndexFieldNumber()
          Returns the number of index fields for the current generic class.
 Logger getLogger()
          Returns a logger to an component that wants to log things.
 LoggerFactory getLoggerFactory()
          Returns a logger factory that allows the creation of new loggers.
 java.lang.String getName()
          Allows to know the name of the current generic class object.
 MetaObject getParent()
          Allows to know the parent MetaObject of the current MetaObject.
 java.util.Iterator iterateIndexField()
          Allows to know all the existing index field for the current generic class.
 void setLogger(Logger logger)
          Defines a logger object.
 void setLoggerFactory(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

BasicGenClass

public BasicGenClass(java.lang.String name,
                     boolean isAbstract,
                     MetaObject parent)
Builds a new BasicGenClass object. This object is built with its name, and its parent.

Parameters:
name - the name of the generic class
isAbstract - true, the generic class is an abstract class, else false, the generic class is not an abstract class
parent - the parent meta-object of the current GenClass
Method Detail

getName

public java.lang.String getName()
Allows to know the name of the current generic class object.

Specified by:
getName in interface GenClass
Returns:
the string representation of the generic class name

createIndexField

public PrimitiveElement createIndexField(java.lang.String indexFieldName,
                                         PType type)
Returns a new PrimitiveElement object, created with its name and its type (PType). As the current Class is generic, the field of the class is an index field. If the field already exists, it is returned, else a new one is created.

Specified by:
createIndexField in interface GenClass
Parameters:
indexFieldName - the name of the index field
type - the type of the index field
Returns:
a new PrimitiveField for the current generic class

getIndexField

public PrimitiveElement getIndexField(java.lang.String indexFieldName)
Returns the PrimitiveElement corresponding to its name. If no field corresponds to this name, null is returned.

Specified by:
getIndexField in interface GenClass
Parameters:
indexFieldName - the name of the index field
Returns:
an existing index field. If the index field does not exist, null is returned.

iterateIndexField

public java.util.Iterator iterateIndexField()
Allows to know all the existing index field for the current generic class. This iterator contains PrimitiveElement objects. If no index field exists, an empty iterator is returned.

Specified by:
iterateIndexField in interface GenClass
Returns:
an Iterator on index field (PrimitiveElement). If there is no index field to return, an empty iterator is returned.

getIndexFieldNumber

public int getIndexFieldNumber()
Returns the number of index fields for the current generic class.

Specified by:
getIndexFieldNumber in interface GenClass
Returns:
the integer number of the index fields for the generic class

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(Logger logger)
Defines a logger object.

Specified by:
setLogger in interface Loggable
Parameters:
logger - the logger object

setLoggerFactory

public void setLoggerFactory(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 Logger getLogger()
Description copied from interface: Loggable
Returns a logger to an component that wants to log things.

Specified by:
getLogger in interface Loggable

getLoggerFactory

public LoggerFactory getLoggerFactory()
Description copied from interface: Loggable
Returns a logger factory that allows the creation of new loggers.

Specified by:
getLoggerFactory in interface Loggable