org.simpleds.metadata
Class ClassMetadata

java.lang.Object
  extended by org.simpleds.metadata.ClassMetadata

public class ClassMetadata
extends java.lang.Object


Constructor Summary
ClassMetadata()
           
 
Method Summary
 void add(MultivaluedIndexMetadata metadata)
           
 void add(PropertyMetadata<?,?> property)
           
 boolean contains(java.lang.String propertyName)
           
 com.google.appengine.api.memcache.Expiration createCacheExpiration()
          Create a Expiration instance to be used with memcache
<T> T
datastoreToJava(com.google.appengine.api.datastore.Entity entity)
          Convert a value from Google representation to a Java value
 int getCacheSeconds()
           
 PropertyMetadata<com.google.appengine.api.datastore.Key,com.google.appengine.api.datastore.Key> getKeyProperty()
           
 java.lang.String getKind()
           
 MultivaluedIndexMetadata getMultivaluedIndex(java.lang.String relationIndexName)
           
 java.util.Set<java.lang.String> getParents()
           
 java.lang.Class<?> getPersistentClass()
           
<J,D> PropertyMetadata<J,D>
getProperty(java.lang.String propertyName)
           
 java.util.Iterator<java.lang.String> getPropertyNames()
           
 java.util.Set<java.lang.String> getRequiredProperties()
           
 VersionManager getVersionManager()
           
 boolean isCacheable()
           
 boolean isGenerateKeyValue()
           
 com.google.appengine.api.datastore.Entity javaToDatastore(com.google.appengine.api.datastore.Key parentKey, java.lang.Object javaObject)
          Convert a value from Java representation to a Datastore Entity
 void populate(com.google.appengine.api.datastore.Entity from, java.lang.Object to)
          Copy all properties from the datastore entity into the persistent class instance passed as an attribute.
 void setCacheSeconds(int cacheSeconds)
           
 void setGenerateKeyValue(boolean generateKey)
           
 void setKind(java.lang.String kind)
           
 void setParents(java.util.Set<java.lang.String> parents)
           
 void setPersistentClass(java.lang.Class<?> persistentClass)
           
 void setProperties(java.util.Map<java.lang.String,PropertyMetadata<?,?>> properties)
           
 void setVersionManager(VersionManager versionManager)
           
 boolean useLevel2Cache()
           
 void validate()
           
 void validateConstraints(com.google.appengine.api.datastore.Entity entity)
          Validate the schema constraints on the provided Entity instance
 void validateParentKey(com.google.appengine.api.datastore.Key parentKey)
          Validates the parent key when inserting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassMetadata

public ClassMetadata()
Method Detail

datastoreToJava

public <T> T datastoreToJava(com.google.appengine.api.datastore.Entity entity)
Convert a value from Google representation to a Java value

Parameters:
entity - the persistent Entity from the google datastore

populate

public void populate(com.google.appengine.api.datastore.Entity from,
                     java.lang.Object to)
Copy all properties from the datastore entity into the persistent class instance passed as an attribute.

Parameters:
from - the entity read from the datastore
to - the java object to populate. Cannot be null.

validateConstraints

public void validateConstraints(com.google.appengine.api.datastore.Entity entity)
Validate the schema constraints on the provided Entity instance

Parameters:
entity - the entity to validate

javaToDatastore

public com.google.appengine.api.datastore.Entity javaToDatastore(com.google.appengine.api.datastore.Key parentKey,
                                                                 java.lang.Object javaObject)
Convert a value from Java representation to a Datastore Entity

Parameters:
javaObject - the Java property value
parentKey - the parent Key (may be null)

validate

public void validate()

add

public void add(PropertyMetadata<?,?> property)

contains

public boolean contains(java.lang.String propertyName)
Returns:
true if this metadata instance contains a property or key with the provided name

getPersistentClass

public java.lang.Class<?> getPersistentClass()

setPersistentClass

public void setPersistentClass(java.lang.Class<?> persistentClass)

getProperty

public <J,D> PropertyMetadata<J,D> getProperty(java.lang.String propertyName)

getMultivaluedIndex

public MultivaluedIndexMetadata getMultivaluedIndex(java.lang.String relationIndexName)

validateParentKey

public void validateParentKey(com.google.appengine.api.datastore.Key parentKey)
Validates the parent key when inserting


isCacheable

public boolean isCacheable()
Returns:
true if this class is cacheable

add

public void add(MultivaluedIndexMetadata metadata)

getPropertyNames

public java.util.Iterator<java.lang.String> getPropertyNames()

setProperties

public void setProperties(java.util.Map<java.lang.String,PropertyMetadata<?,?>> properties)

isGenerateKeyValue

public boolean isGenerateKeyValue()

setGenerateKeyValue

public void setGenerateKeyValue(boolean generateKey)

getKeyProperty

public PropertyMetadata<com.google.appengine.api.datastore.Key,com.google.appengine.api.datastore.Key> getKeyProperty()

getRequiredProperties

public java.util.Set<java.lang.String> getRequiredProperties()

getKind

public java.lang.String getKind()

setKind

public void setKind(java.lang.String kind)

setParents

public void setParents(java.util.Set<java.lang.String> parents)

getParents

public java.util.Set<java.lang.String> getParents()

getCacheSeconds

public int getCacheSeconds()

setCacheSeconds

public void setCacheSeconds(int cacheSeconds)

createCacheExpiration

public com.google.appengine.api.memcache.Expiration createCacheExpiration()
Create a Expiration instance to be used with memcache


useLevel2Cache

public boolean useLevel2Cache()

setVersionManager

public void setVersionManager(VersionManager versionManager)

getVersionManager

public VersionManager getVersionManager()