|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectthinkmap.expression.runtime.PropertyHandler
thinkmap.client.EntityType
public class EntityType
Every entity in Thinkmap has an EntityType. EntityTypes are similar to Prototypes in JavaScript. A property set on an EntityType is available to all entities that have that EntityType as a parent. This allows the user to easily implement things like "make all entities that represent employees blue."
EntityTypes belong to a SourceManager, and are identified by a unique name. EntityTypes can be chained, in which case, they have a "super" EntityType, which is the name of the EntityType that they inherit their properties from.
EntityTypes may also contain Entity metadata, which is metadata about the Entities that belong to that EntityType. Metadata consists of two parts, id metadata and property metadata. Id metadata is information about the id's of Entities that belong to this type. Specifically, the number of keys and their types. Property metadata is information about the types of properties that the entities of this type will have.
EntityTypes can also be serialized to/from an IDataSource, via the writeTo() method.
| Field Summary | |
|---|---|
protected Byte |
cacheFlag
|
protected Hashtable |
providedProperties
|
| Fields inherited from class thinkmap.expression.runtime.PropertyHandler |
|---|
parent |
| Constructor Summary | |
|---|---|
EntityType()
Creates a new EntityType object. |
|
EntityType(String entityType,
String superType)
Creates a new EntityType object. |
|
| Method Summary | |
|---|---|
void |
addProperty(Property pp)
Adds a property to this EntityType that was configured via XML. |
void |
addPropertyMD(Property pp)
Adds metadata this EntityType that was configured via XML. |
Property |
createProperty()
Create a property for configuration that will later be added via the addProperty() method. |
Property |
createPropertyMD()
Create metadata for configuration that will later be added via the addMetadata() method. |
Object |
getAttribute(String name)
Get an attribute from the EntityType |
Class[] |
getIdMetadata()
Returns the EntityId that describes the Entities that belong to this EntityType. |
Property[] |
getMetadata()
|
String |
getName()
Get the name of this EntityType |
Object |
getPropertyAttribute(String propertyName,
String attributeName)
Get an attribute of a provided property |
Object |
getPropertyMDAttribute(String propertyName,
String attributeName)
Get an attribute of a provided property |
Enumeration |
getPropertyMetadataNames()
Gets the names of the properties that have been defined via the setMetadata method. |
Property[] |
getProvidedProperties()
|
String |
getSuperType()
Get the super type of this EntityType. |
boolean |
isCached()
Returns true if entities of this type are cached. |
void |
setAttribute(String name,
Object value)
Set an attribute on the EntityType |
void |
setAttributes(Hashtable cache)
Set many attributes at once |
void |
setCached(boolean cache)
Set to true if all entities of this type should be cached. |
void |
setIdMetadata(Class[] id)
Sets the classes that describe the types of the keys of entities that belong to this entity type. |
void |
setName(String s)
Set the name of this EntityType. |
void |
setSuperType(String s)
Set the name of the super type of this EntityType |
String |
toString()
|
void |
updateFrom(EntityType other)
Update with values from another copy of this EntityType |
protected void |
writePersistedProperties(IEntityHandler handler,
SourceEntity entity)
Write all properties to an IEntityHandler if they are supposed to be persisted. |
void |
writeTo(IEntityHandler handler)
Serialize this EntityType over the given IEntityHandler |
| Methods inherited from class thinkmap.expression.runtime.PropertyHandler |
|---|
copyTo, getLocalProperty, getLocalPropertyNames, getNextPropertyHandler, getProperty, getPropertyNames, main, propertyUpdated, removeProperty, setCaching, setProperty |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Hashtable providedProperties
protected Byte cacheFlag
| Constructor Detail |
|---|
public EntityType()
public EntityType(String entityType,
String superType)
entityType - the name of this EntityTypesuperType - the name of this EntityType's parent EntityType, or
null if there is none| Method Detail |
|---|
public Property createProperty()
public Property createPropertyMD()
public void addProperty(Property pp)
throws Exception
pp - a property to add to this EntityType
Exceptionpublic void addPropertyMD(Property pp)
pp - a property to add to this EntityTypepublic Enumeration getPropertyMetadataNames()
public Object getPropertyAttribute(String propertyName,
String attributeName)
public Object getPropertyMDAttribute(String propertyName,
String attributeName)
public Class[] getIdMetadata()
public void setIdMetadata(Class[] id)
id - the EntityId that describes the Entities that belong to this EntityType.public String getName()
public void setName(String s)
s - new namepublic String getSuperType()
public void setSuperType(String s)
s - new super type namepublic void writeTo(IEntityHandler handler)
handler - the handler to write to.public String toString()
toString in class Objectpublic Property[] getProvidedProperties()
public Property[] getMetadata()
public void setAttribute(String name,
Object value)
public void setAttributes(Hashtable cache)
public Object getAttribute(String name)
public void setCached(boolean cache)
cache - public boolean isCached()
public void updateFrom(EntityType other)
protected void writePersistedProperties(IEntityHandler handler,
SourceEntity entity)
handler - The place to write the propertiesentity - The entity being written.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||