org.objectweb.jorm.metainfo.lib
Class BasicClassRef

java.lang.Object
  extended byorg.objectweb.jorm.metainfo.lib.BasicMetaObject
      extended byorg.objectweb.jorm.metainfo.lib.BasicClassRef
All Implemented Interfaces:
ClassRef, java.lang.Comparable, Loggable, MetaObject, Reference, java.io.Serializable, TypedElement

public class BasicClassRef
extends BasicMetaObject
implements ClassRef, java.lang.Comparable

BasicClassRef defines a reference to a class which is class field. This object is created by the Class object to define its fields.

Author:
X. Spengler
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.objectweb.jorm.metainfo.lib.BasicMetaObject
debug, logger, loggerFactory, parent
 
Constructor Summary
BasicClassRef(java.lang.String fieldName, Class currentClass, MetaObject parent)
          Builds a new BasicClassRef object.
 
Method Summary
 int compareTo(java.lang.Object o)
           
 NameDef createRefNameDef()
          Creates a new NameDef object for the current reference class object.
protected  java.util.Collection getChildren()
           
 java.lang.String getClassName()
          Returns the name of the class ref.
 Class getMOClass()
          Returns the Class object which describes the ClassRef entity.
 java.lang.String getName()
          Returns the name of the current typed element.
 java.util.Collection getRefNameDef()
          Returns an iterator on existing NameDef for the current Class.
 NameDef getRefNameDef(java.lang.String name)
          Returns a NameDef object.
 PType getType()
          Allows to know the type of the field.
 
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicMetaObject
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.MetaObject
getParent, setParent
 

Constructor Detail

BasicClassRef

public BasicClassRef(java.lang.String fieldName,
                     Class currentClass,
                     MetaObject parent)
Builds a new BasicClassRef object. This object is defined by its name, the reference to the class and its parent.

Parameters:
fieldName - the string representation of the field name
currentClass - the reference to the class
parent - the parent of the current object
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

getMOClass

public Class getMOClass()
Returns the Class object which describes the ClassRef entity. This object is used as the type of a field.

Specified by:
getMOClass in interface ClassRef
Returns:
the Class Object contained by the current class ref object

getClassName

public java.lang.String getClassName()
Returns the name of the class ref.

Specified by:
getClassName in interface ClassRef
Returns:
the name of the class reference meta 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

createRefNameDef

public NameDef createRefNameDef()
Creates a new NameDef object for the current reference class object. If this NameDef already exists for the current object, it is returned, in other case, a new NameDef object is created and returned.

Specified by:
createRefNameDef in interface Reference
Returns:
a new object used to describe the name projection for the current reference class, or an existing one if it already exists

getRefNameDef

public NameDef getRefNameDef(java.lang.String name)
Returns a NameDef object. If the namedef does not exist, null is returned.

Specified by:
getRefNameDef in interface Reference
Parameters:
name - the name of the NameDef object.
Returns:
an existing namedef object, else null is returned.

getRefNameDef

public java.util.Collection getRefNameDef()
Returns an iterator on existing NameDef for the current Class. This method returns an empty iterator if no namedef exists in this Class.

Specified by:
getRefNameDef in interface Reference
Returns:
an iterator on NameDef, or an empty iterator if no namedef is defined

getChildren

protected java.util.Collection getChildren()
Overrides:
getChildren in class BasicMetaObject