|
Homepage | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tinymarbles.model.Persistent<String>
org.tinymarbles.model.PType
public class PType
Describes a persistent type.
| Constructor Summary | |
|---|---|
protected |
PType()
Protected constructor for Hibernate |
|
PType(String name)
Public constructor |
| Method Summary | |
|---|---|
protected void |
add(PAttribute att)
Used internally. |
void |
addDirtyInstance(PObject dirty)
Add dirty PObject instance |
List<PAttribute> |
attributes()
Gets an ordered list of persistent attributes. |
String |
describe()
Builds a description based on the attributes defined for this type. |
boolean |
equals(Object obj)
|
void |
fromMap(Map<String,Class<? extends PValue>> map)
Populates this PType with new attributes based on a Map of Attribute names and its respectives value classes |
PAttribute |
getAttribute(String attName)
Gets the persistent attribute with the given name |
Set<String> |
getAttributeNames()
Gets the set of attribute names from this type. |
protected Map<String,PAttribute> |
getAttributes()
Used internally. |
Set<PObject> |
getDirtyInstances()
List all dirty instances from this type |
String |
getName()
Gets the name of this type |
String |
getPersistentIdentifier()
Returns the persistent identifier for the type. |
Integer |
getVersion()
Used internally. |
boolean |
hasAttribute(String attName)
Returns true if this type has an attribute with name attName. |
int |
hashCode()
|
boolean |
isPersistent()
Asks if the object is known by the repository |
PObject |
newInstance()
Creates a new persistent object of this type. |
PObject |
newInstance(String systemId)
Creates a new persistent object of this type. |
PType |
put(String attName,
Class<? extends PValue> valueClass)
Same as putAttribute but returns this instance to allow chaining. |
PAttribute |
putAttribute(String attName,
Class<? extends PValue> valueClass)
Puts an attribute in this type. |
void |
remove(String attName)
Removes an attribute from this type. |
void |
removeDirtyInstance(PObject dirty)
Remove dirty PObject instance |
protected void |
setAttributes(Map<String,PAttribute> attributes)
Used internally. |
Map<String,Class<? extends PValue>> |
toMap()
Gets a map with all attributes and its valueclass |
String |
toString()
Returns a string representation of this instance. |
| Methods inherited from class org.tinymarbles.model.Persistent |
|---|
delete, refresh, save |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PType(String name)
name - the name of the type. Must be unique in the repositoryprotected PType()
| Method Detail |
|---|
public Integer getVersion()
protected Map<String,PAttribute> getAttributes()
public Set<String> getAttributeNames()
attributes()protected void setAttributes(Map<String,PAttribute> attributes)
attributes - the attribute mappingpublic String getName()
public PAttribute putAttribute(String attName,
Class<? extends PValue> valueClass)
throws TypeMismatchException
attName - the name of the attributevalueClass - the class of the implementation of this attribute.
TypeMismatchException - if there is another attribute with the same name, but a different value classgetAttribute(String)
public PType put(String attName,
Class<? extends PValue> valueClass)
throws TypeMismatchException
attName - the name of the attributevalueClass - the class of the implementation of this attribute.
TypeMismatchException - if there is another attribute with the same name, but a different value classputAttribute(String, Class)protected void add(PAttribute att)
att - the attribute to addpublic void remove(String attName)
attName - the name of the attribute to be removedpublic boolean hasAttribute(String attName)
attName. Returns false otherwise.
attName -
public PAttribute getAttribute(String attName)
throws UnknownAttributeException
attName - the name of the attribute
UnknownAttributeException - if no attribute with the given name is definedpublic Map<String,Class<? extends PValue>> toMap()
public void fromMap(Map<String,Class<? extends PValue>> map)
throws UnknownAttributeException
map - a map of attribute names and values
UnknownAttributeException - if a attribute in the map doesn't existpublic List<PAttribute> attributes()
PAttribute.getIndex()public String describe()
public String toString()
toString in class Objectdescribe()public String getPersistentIdentifier()
getPersistentIdentifier in class Persistent<String>getName()public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic boolean isPersistent()
Persistent
isPersistent in class Persistent<String>Persistent.getPersistentIdentifier()public PObject newInstance(String systemId)
systemId - the system ID of the object
newInstance()public PObject newInstance()
newInstance(String)public Set<PObject> getDirtyInstances()
public void addDirtyInstance(PObject dirty)
dirty - a PObject that must be savedpublic void removeDirtyInstance(PObject dirty)
dirty - a PObject that must be removed
|
Homepage | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||