Cumulus4j API
(1.0.1)

org.cumulus4j.store.model
Class ClassMeta

java.lang.Object
  extended by org.cumulus4j.store.model.ClassMeta

public class ClassMeta
extends Object

Persistent meta-data for a persistence-capable Class. Since class names are very long, we use the classID instead in our index and data entities (e.g. in the relation DataEntry.classMeta).

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de

Constructor Summary
protected ClassMeta()
           
  ClassMeta(Class<?> clazz)
           
 
Method Summary
 void addFieldMeta(FieldMeta fieldMeta)
           
 boolean equals(Object obj)
           
 long getClassID()
           
static ClassMeta getClassMeta(PersistenceManager pm, Class<?> clazz, boolean throwExceptionIfNotFound)
           
static ClassMeta getClassMeta(PersistenceManager pm, String packageName, String simpleClassName, boolean throwExceptionIfNotFound)
           
 String getClassName()
          Get the fully qualified class name (composed of packageName and simpleClassName).
 AbstractClassMetaData getDataNucleusClassMetaData(ExecutionContext executionContext)
           
 FieldMeta getFieldMeta(long fieldID)
          Get the FieldMeta with the specified fieldID.
 FieldMeta getFieldMeta(String fieldName)
          Get the FieldMeta for a field that is directly declared in the class referenced by this ClassMeta.
 FieldMeta getFieldMeta(String className, String fieldName)
           Get the FieldMeta for a field that is either directly declared in the class referenced by this ClassMeta or in a super-class.
 Collection<FieldMeta> getFieldMetas()
          Get all FieldMeta instances known to this instance.
 String getPackageName()
          Get the package name or an empty String for the default package.
 String getSimpleClassName()
           
 ClassMeta getSuperClassMeta()
          The super-class' meta-data or null, if there is no persistence-capable super-class.
 int hashCode()
           
 void removeFieldMeta(FieldMeta fieldMeta)
           
 void setSuperClassMeta(ClassMeta superClassMeta)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassMeta

protected ClassMeta()

ClassMeta

public ClassMeta(Class<?> clazz)
Method Detail

getClassMeta

public static ClassMeta getClassMeta(PersistenceManager pm,
                                     String packageName,
                                     String simpleClassName,
                                     boolean throwExceptionIfNotFound)

getClassMeta

public static ClassMeta getClassMeta(PersistenceManager pm,
                                     Class<?> clazz,
                                     boolean throwExceptionIfNotFound)

getClassID

public long getClassID()

getPackageName

public String getPackageName()
Get the package name or an empty String for the default package.

Returns:
the package name (maybe empty, but never null).

getSimpleClassName

public String getSimpleClassName()

getClassName

public String getClassName()
Get the fully qualified class name (composed of packageName and simpleClassName).

Returns:
the fully qualified class name.

getSuperClassMeta

public ClassMeta getSuperClassMeta()
The super-class' meta-data or null, if there is no persistence-capable super-class.

Returns:
the super-class' meta-data or null.

setSuperClassMeta

public void setSuperClassMeta(ClassMeta superClassMeta)

getFieldMetas

public Collection<FieldMeta> getFieldMetas()
Get all FieldMeta instances known to this instance. This is the meta-data for all fields directly declared in the class referenced by this ClassMeta not including super-classes.

Returns:
Collection of FieldMeta objects for this class

getFieldMeta

public FieldMeta getFieldMeta(String fieldName)
Get the FieldMeta for a field that is directly declared in the class referenced by this ClassMeta. This method thus does not take super-classes into account.

Parameters:
fieldName - the simple field name (no class prefix).
Returns:
the FieldMeta corresponding to the specified fieldName or null, if no such field exists.
See Also:
getFieldMeta(long), getFieldMeta(String, String)

getFieldMeta

public FieldMeta getFieldMeta(String className,
                              String fieldName)

Get the FieldMeta for a field that is either directly declared in the class referenced by this ClassMeta or in a super-class.

If className is null, this method searches recursively in the inheritance hierarchy upwards (i.e. first this class then the super-class, then the next super-class etc.) until it finds a field matching the given fieldName.

If className is not null, this method searches only in the specified class. If className is neither the current class nor any super-class, this method always returns null.

Parameters:
className - the fully qualified class-name of the class referenced by this ClassMeta or any super-class. null to search the entire class hierarchy upwards (through all super-classes until the field is found or the last super-class was investigated).
fieldName - the simple field name (no class prefix).
Returns:
the FieldMeta matching the given criteria or null if no such field could be found.

getFieldMeta

public FieldMeta getFieldMeta(long fieldID)
Get the FieldMeta with the specified fieldID. It does not matter, if this field is directly in the class referenced by this ClassMeta or in a super-class.

Parameters:
fieldID - the fieldID of the FieldMeta to be found.
Returns:
the FieldMeta referenced by the given fieldID or null, if no such field exists in the class or any super-class.

addFieldMeta

public void addFieldMeta(FieldMeta fieldMeta)

removeFieldMeta

public void removeFieldMeta(FieldMeta fieldMeta)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

getDataNucleusClassMetaData

public AbstractClassMetaData getDataNucleusClassMetaData(ExecutionContext executionContext)

Cumulus4j API
(1.0.1)

Copyright © 2012 NightLabs Consulting GmbH. All Rights Reserved.