Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.cayenne.map
Class ObjEntity  view ObjEntity download ObjEntity.java

java.lang.Object
  extended byorg.objectstyle.cayenne.map.MapObject
      extended byorg.objectstyle.cayenne.map.Entity
          extended byorg.objectstyle.cayenne.map.ObjEntity
All Implemented Interfaces:
org.objectstyle.cayenne.util.CayenneMapEntry

public class ObjEntity
extends Entity

ObjEntity is a mapping descriptor for a DataObject Java class. It contains the information about the Java class itself, as well as its mapping to the DbEntity layer.


Nested Class Summary
 
Nested classes inherited from class org.objectstyle.cayenne.map.Entity
Entity.PathIterator
 
Field Summary
protected  java.lang.String className
           
protected  DbEntity dbEntity
           
protected  boolean readOnly
           
protected  java.lang.String superClassName
           
 
Fields inherited from class org.objectstyle.cayenne.map.Entity
attributes, attributesMapRef, attributesRef, PATH_SEPARATOR, queries, relationships, relationshipsRef
 
Fields inherited from class org.objectstyle.cayenne.map.MapObject
objName, objParent
 
Constructor Summary
ObjEntity()
           
ObjEntity(java.lang.String name)
           
 
Method Summary
 void clearDbMapping()
          Clears all the mapping between this obj entity and its current db entity.
 ObjAttribute getAttributeForDbAttribute(DbAttribute dbAttr)
          Returns ObjAttribute of this entity that maps to dbAttr parameter.
 java.lang.String getClassName()
          Returns the name of the corresponding data object class
 DbEntity getDbEntity()
          Returns a DbEntity that this ObjEntity is mapped to.
 java.lang.Class getJavaClass()
          Returns Java class of persistent objects described by this entity.
 ObjRelationship getRelationshipForDbRelationship(DbRelationship dbRel)
          Returns ObjRelationship of this entity that maps to dbRel parameter.
 java.lang.String getSuperClassName()
          Returns the fully qualified name of the super class of the data object class for this entity Used in the modeller and in class generation only, not at "runtime"
 java.util.Map idSnapshotMapFromSnapshot(java.util.Map objectSnapshot)
          Creates an id snapshot (the key/value pairs for the pk of the object) from the values in object snapshot.
 boolean isReadOnly()
          Returns true if this ObjEntity represents a set of read-only objects.
 org.objectstyle.cayenne.ObjectId objectIdFromSnapshot(java.util.Map objectSnapshot)
          Creates an object id from the values in object snapshot.
 void setClassName(java.lang.String className)
          Sets the name of the data object class described by this obj entity
 void setDbEntity(DbEntity dbEntity)
          Sets the DbEntity used by this ObjEntity.
 void setReadOnly(boolean readOnly)
           
 void setSuperClassName(java.lang.String parentClassName)
          Sets the name of the super class of the data object class for this entity Used in the modeller and in class generation only, not at "runtime"
 void validate()
           
protected  void validateQueryRoot(org.objectstyle.cayenne.query.Query query)
          Helper method that checks that a Query belongs to this entity by validating query root object.
 
Methods inherited from class org.objectstyle.cayenne.map.Entity
addAttribute, addQuery, addRelationship, clearAttributes, clearQueries, clearRelationships, getAttribute, getAttributeMap, getAttributes, getDataMap, getQuery, getRelationship, getRelationshipMap, getRelationships, removeAttribute, removeQuery, removeRelationship, resolvePathComponents, resolvePathComponents, setDataMap
 
Methods inherited from class org.objectstyle.cayenne.map.MapObject
getName, getParent, setName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

superClassName

protected java.lang.String superClassName

className

protected java.lang.String className

dbEntity

protected DbEntity dbEntity

readOnly

protected boolean readOnly
Constructor Detail

ObjEntity

public ObjEntity()

ObjEntity

public ObjEntity(java.lang.String name)
Method Detail

getJavaClass

public java.lang.Class getJavaClass()
Returns Java class of persistent objects described by this entity. Casts any thrown exceptions into CayenneRuntimeException.


getClassName

public java.lang.String getClassName()
Returns the name of the corresponding data object class


setClassName

public void setClassName(java.lang.String className)
Sets the name of the data object class described by this obj entity


getSuperClassName

public java.lang.String getSuperClassName()
Returns the fully qualified name of the super class of the data object class for this entity Used in the modeller and in class generation only, not at "runtime"


setSuperClassName

public void setSuperClassName(java.lang.String parentClassName)
Sets the name of the super class of the data object class for this entity Used in the modeller and in class generation only, not at "runtime"


getDbEntity

public DbEntity getDbEntity()
Returns a DbEntity that this ObjEntity is mapped to.


setDbEntity

public void setDbEntity(DbEntity dbEntity)
Sets the DbEntity used by this ObjEntity.


getAttributeForDbAttribute

public ObjAttribute getAttributeForDbAttribute(DbAttribute dbAttr)
Returns ObjAttribute of this entity that maps to dbAttr parameter. Returns null if no such attribute is found.


getRelationshipForDbRelationship

public ObjRelationship getRelationshipForDbRelationship(DbRelationship dbRel)
Returns ObjRelationship of this entity that maps to dbRel parameter. Returns null if no such relationship is found.


idSnapshotMapFromSnapshot

public java.util.Map idSnapshotMapFromSnapshot(java.util.Map objectSnapshot)
Creates an id snapshot (the key/value pairs for the pk of the object) from the values in object snapshot. If needed attributes are missing in a snapshot or if it is null, CayenneRuntimeException is thrown.


objectIdFromSnapshot

public org.objectstyle.cayenne.ObjectId objectIdFromSnapshot(java.util.Map objectSnapshot)
Creates an object id from the values in object snapshot. If needed attributes are missing in a snapshot or if it is null, CayenneRuntimeException is thrown.


clearDbMapping

public void clearDbMapping()
Clears all the mapping between this obj entity and its current db entity. Clears mapping between entities, attributes and relationships.


isReadOnly

public boolean isReadOnly()
Returns true if this ObjEntity represents a set of read-only objects.


setReadOnly

public void setReadOnly(boolean readOnly)

validateQueryRoot

protected void validateQueryRoot(org.objectstyle.cayenne.query.Query query)
                          throws java.lang.IllegalArgumentException
Description copied from class: Entity
Helper method that checks that a Query belongs to this entity by validating query root object.

Specified by:
validateQueryRoot in class Entity

validate

public void validate()
              throws org.objectstyle.cayenne.CayenneException