org.objectweb.jorm.metainfo.lib
Class BasicPackage

java.lang.Object
  extended byorg.objectweb.jorm.metainfo.lib.BasicPackage
All Implemented Interfaces:
Loggable, MetaObject, Package, java.io.Serializable

public class BasicPackage
extends java.lang.Object
implements Package, Loggable

BasicPackage is an implementation of the Package interface. This object defines a set of classes and generic classes declared in a Package tag. Its parent is the Manager.

Author:
X. Spengler
See Also:
Serialized Form

Field Summary
protected  java.util.Map classes
          This structure contains all declared classes for the current schema object.
protected  java.util.Map compositeNames
          This structure contains all declared compositename for the current schema object.
 Logger logger
          a simple logger to log
protected  java.lang.String name
          The name of the schema, this name could be null if the name is not defined by the user.
protected  MetaObject parent
          the parent object for the schema (Manager) which is a MetaObject.
 
Constructor Summary
BasicPackage(java.lang.String name, Manager parent)
          Builds a new Package object.
 
Method Summary
 void addClass(Class aClass)
          Adds an existing Class to the current Package
 void addCompositeName(CompositeName composite)
          Adds an existing CompositeName to the current Package
 Class createClass(java.lang.String className)
          Returns a new Class created with a class name.
 CompositeName createCompositeName(java.lang.String CN_Name)
          Returns a new compositename identified by its name.
 Class getClass(java.lang.String className)
          Returns a Class created with a class name.
 java.util.Collection getClasses()
          Allows to know all the registered classes into the current schema.
 CompositeName getCompositeName(java.lang.String cn_Name)
          Returns a compositename identified with its name.
 java.util.Collection getCompositeNames()
          Allows to know all the registered classes into the current schema.
 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()
          Returns the name of the schema.
 MetaObject getParent()
          Allows to know the parent MetaObject of the current MetaObject.
 java.util.Iterator iterateCompositeName()
          Allows to know all the registered compositename into the current schema.
 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
 

Field Detail

classes

protected java.util.Map classes
This structure contains all declared classes for the current schema object. key: the name of the class value: the Class MetaObject object


compositeNames

protected java.util.Map compositeNames
This structure contains all declared compositename for the current schema object. key: the name of the class value: the Class MetaObject object


name

protected java.lang.String name
The name of the schema, this name could be null if the name is not defined by the user.


parent

protected MetaObject parent
the parent object for the schema (Manager) which is a MetaObject.


logger

public transient Logger logger
a simple logger to log

Constructor Detail

BasicPackage

public BasicPackage(java.lang.String name,
                    Manager parent)
Builds a new Package object. This object is defined by its name and its parent.

Parameters:
name - the name of the schema to create
parent - the parent meta-object
Method Detail

getName

public java.lang.String getName()
Returns the name of the schema.

Specified by:
getName in interface Package
Returns:
the string representation of the name of the schema. Null is returned if there is no schema name else a not empty dotted string.

getClass

public Class getClass(java.lang.String className)
Returns a Class created with a class name.

Specified by:
getClass in interface Package
Parameters:
className - the string representation of the class name
Returns:
a Class corresponding to its name. If the Class does not exist, null is returned.

getCompositeName

public CompositeName getCompositeName(java.lang.String cn_Name)
Returns a compositename identified with its name.

Specified by:
getCompositeName in interface Package
Parameters:
cn_Name - the string representation of the name of the composite name.
Returns:
a compositename corresponding to its name. If the compositename does not exist, null is returned.

createCompositeName

public CompositeName createCompositeName(java.lang.String CN_Name)
Returns a new compositename identified by its name. The MetaObject is added to the list of compositename classes managed by the current schema. If the compositename already exists, it is returned.

Specified by:
createCompositeName in interface Package
Parameters:
CN_Name - the string representation of the name of the compositename
Returns:
a compositename corresponding to the created compositename and registered, or an existing one if already defined

iterateCompositeName

public java.util.Iterator iterateCompositeName()
Allows to know all the registered compositename into the current schema. This method returns an iterator on compositename object.

Specified by:
iterateCompositeName in interface Package
Returns:
an iterator for compositename object. If there is no class, an empty iterator is returned.

createClass

public Class createClass(java.lang.String className)
Returns a new Class created with a class name. The MetaObject is added to the list of classes managed by the current schema. An isAbstract boolean is defined to know if the current class is an abstract class or not.

Specified by:
createClass in interface Package
Parameters:
className - the string representation of the class name
Returns:
a Class corresponding to the created class and registered, or an existing one if already defined

addClass

public void addClass(Class aClass)
Adds an existing Class to the current Package

Specified by:
addClass in interface Package
Parameters:
aClass - the Class object to add

addCompositeName

public void addCompositeName(CompositeName composite)
Adds an existing CompositeName to the current Package

Specified by:
addCompositeName in interface Package
Parameters:
composite - the CompositeName object to add

getClasses

public java.util.Collection getClasses()
Allows to know all the registered classes into the current schema. This method returns an iterator on Class object.

Specified by:
getClasses in interface Package
Returns:
an iterator for Class object. If there is no class, an empty iterator is returned.

getCompositeNames

public java.util.Collection getCompositeNames()
Description copied from interface: Package
Allows to know all the registered classes into the current schema. This method returns an iterator on Class object.

Specified by:
getCompositeNames in interface Package
Returns:
an iterator for Class object. If there is no class, 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

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