Cumulus4j API
(1.0.2)

org.cumulus4j.store.model
Class ClassMeta

java.lang.Object
  extended by org.cumulus4j.store.model.ClassMeta
All Implemented Interfaces:
DetachCallback

public class ClassMeta
extends Object
implements DetachCallback

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

Nested Class Summary
protected static class ClassMeta.NamedQueries
           
 
Field Summary
protected static ThreadLocal<Set<ClassMeta>> attachedClassMetasInPostDetachThreadLocal
           
 
Constructor Summary
protected ClassMeta()
           
  ClassMeta(Class<?> clazz)
           
 
Method Summary
 void addFieldMeta(FieldMeta fieldMeta)
           
 boolean equals(Object obj)
           
 long getClassID()
           
 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.
 Map<String,FieldMeta> getFieldName2FieldMeta()
           
 String getPackageName()
          Get the package name or an empty String for the default package.
protected  PersistenceManager getPersistenceManager()
          Get the PersistenceManager assigned to this.
 String getSimpleClassName()
           
 ClassMeta getSuperClassMeta()
          The super-class' meta-data or null, if there is no persistence-capable super-class.
 int hashCode()
           
 void jdoPostDetach(Object o)
           
 void jdoPreDetach()
           
 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
 

Field Detail

attachedClassMetasInPostDetachThreadLocal

protected static final ThreadLocal<Set<ClassMeta>> attachedClassMetasInPostDetachThreadLocal
Constructor Detail

ClassMeta

protected ClassMeta()

ClassMeta

public ClassMeta(Class<?> clazz)
Method Detail

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)

getPersistenceManager

protected PersistenceManager getPersistenceManager()
Get the PersistenceManager assigned to this. If there is none, this method checks, if this is new. If this was persisted before, it must have one or an IllegalStateException is thrown.

Returns:
the PersistenceManager assigned to this or null.

getFieldName2FieldMeta

public Map<String,FieldMeta> getFieldName2FieldMeta()

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)

jdoPreDetach

public void jdoPreDetach()
Specified by:
jdoPreDetach in interface DetachCallback

jdoPostDetach

public void jdoPostDetach(Object o)
Specified by:
jdoPostDetach in interface DetachCallback

Cumulus4j API
(1.0.2)

Copyright © 2012 NightLabs Consulting GmbH. All Rights Reserved.