|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.objectify.util.ObjectifyWrapper
public class ObjectifyWrapper
Simple wrapper/decorator for an Objectify interface.
Constructor Summary | |
---|---|
ObjectifyWrapper(Objectify ofy)
Wraps the |
Method Summary | ||
---|---|---|
AsyncObjectify |
async()
Obtain the asynchronous version of the Objectify interface. |
|
|
delete(java.lang.Class<T> clazz,
long id)
A convenience method, shorthand for creating a key and deleting it. |
|
|
delete(java.lang.Class<T> clazz,
java.lang.String name)
A convenience method, shorthand for creating a key and deleting it. |
|
void |
delete(java.lang.Iterable<?> keysOrEntities)
Deletes the specified entities in a parallel batch operation. |
|
void |
delete(java.lang.Object... keysOrEntities)
Deletes the specified entity. |
|
|
find(java.lang.Class<? extends T> clazz,
long id)
Same as get(Class, long) but returns null instead of throwing NotFoundException |
|
|
find(java.lang.Class<? extends T> clazz,
java.lang.String name)
Same as get(Class, name) but returns null instead of throwing NotFoundException |
|
|
find(Key<? extends T> key)
Same as get(Key) but returns null instead of throwing NotFoundException |
|
|
get(java.lang.Class<? extends T> clazz,
java.lang.Iterable<S> idsOrNames)
A convenience method that prevents you from having to assemble all the Keys yourself and calling get(Iterable<Key>) . |
|
|
get(java.lang.Class<? extends T> clazz,
long id)
A convenience method, shorthand for creating a key and calling get() |
|
|
get(java.lang.Class<? extends T> clazz,
S... idsOrNames)
Convenient varargs alias for get(Class>, Iterable>) |
|
|
get(java.lang.Class<? extends T> clazz,
java.lang.String name)
A convenience method, shorthand for creating a key and calling get() |
|
|
get(java.lang.Iterable<? extends Key<? extends T>> keys)
Performs a parallel batch get, returning your entities. |
|
|
get(Key<? extends T>... keys)
Varargs version of get(Iterable) |
|
|
get(Key<? extends T> key)
Gets one instance of your entity. |
|
com.google.appengine.api.datastore.DatastoreService |
getDatastore()
Obtain a DatastoreService with parameters roughly equivalent to this Objectify instance. |
|
ObjectifyFactory |
getFactory()
Obtain the ObjectifyFactory from which this Objectify instance was created. |
|
com.google.appengine.api.datastore.Transaction |
getTxn()
Get the underlying transaction object associated with this Objectify instance. |
|
|
put(java.lang.Iterable<? extends T> objs)
Saves multiple entities to the datastore in a single parallel batch operation. |
|
|
put(T... objs)
Convenient varargs alias for put(Iterable>) |
|
|
put(T obj)
Puts an entity in the datastore. |
|
|
query()
Create a typesafe query across all kinds of entities. |
|
|
query(java.lang.Class<T> clazz)
Create a typesafe query across one specific kind of entity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectifyWrapper(Objectify ofy)
Method Detail |
---|
public <T> java.util.Map<Key<T>,T> get(java.lang.Iterable<? extends Key<? extends T>> keys)
Objectify
Performs a parallel batch get, returning your entities. This is faster and more efficient than fetching entities one at a time.
You can fetch entities of many different kinds in a single call. Entities not present in the datastore will be absent from the returned map. Otherwise, the iteration order of the result will match the order in the parameter.
get
in interface Objectify
keys
- are the keys to fetch; you can mix and match the types of objects.
keys
argument.
A empty map is returned if no keys are found in the datastore.DatastoreService.get(Iterable)
public <T> java.util.Map<Key<T>,T> get(Key<? extends T>... keys)
Objectify
Varargs version of get(Iterable)
get
in interface Objectify
public <T> T get(Key<? extends T> key) throws NotFoundException
Objectify
Gets one instance of your entity.
get
in interface Objectify
NotFoundException
- if the key does not exist in the datastoreDatastoreService.get(Key)
public <T> T get(java.lang.Class<? extends T> clazz, long id) throws NotFoundException
Objectify
A convenience method, shorthand for creating a key and calling get()
get
in interface Objectify
NotFoundException
- if the key does not exist in the datastorepublic <T> T get(java.lang.Class<? extends T> clazz, java.lang.String name) throws NotFoundException
Objectify
A convenience method, shorthand for creating a key and calling get()
get
in interface Objectify
NotFoundException
- if the key does not exist in the datastorepublic <S,T> java.util.Map<S,T> get(java.lang.Class<? extends T> clazz, java.lang.Iterable<S> idsOrNames)
Objectify
A convenience method that prevents you from having to assemble all the Keys
yourself and calling get(Iterable<Key>)
.
Note that unlike the standard batch get method, this method only gets a homogeneous set of objects.
get
in interface Objectify
idsOrNames
- must be of type Iterablepublic <S,T> java.util.Map<S,T> get(java.lang.Class<? extends T> clazz, S... idsOrNames)
Objectify
get
in interface Objectify
public <T> T find(Key<? extends T> key)
Objectify
get(Key)
but returns null instead of throwing NotFoundException
find
in interface Objectify
public <T> T find(java.lang.Class<? extends T> clazz, long id)
Objectify
get(Class, long)
but returns null instead of throwing NotFoundException
find
in interface Objectify
public <T> T find(java.lang.Class<? extends T> clazz, java.lang.String name)
Objectify
get(Class, name)
but returns null instead of throwing NotFoundException
find
in interface Objectify
public <T> Key<T> put(T obj)
Objectify
Puts an entity in the datastore.
If your entity has a null Long id, a fresh id will be generated and a new entity will be created in the database. If your entity already has an id (either long, Long, or String) value, any existing entity in the datastore with that id will be overwritten.
Generated ids are stored in the entity itself. If you put() an entity with a null Long id, it will be set before the method returns.
put
in interface Objectify
obj
- must be an object of a registered entity type.
DatastoreService.put(com.google.appengine.api.datastore.Entity)
public <T> java.util.Map<Key<T>,T> put(java.lang.Iterable<? extends T> objs)
Objectify
Saves multiple entities to the datastore in a single parallel batch operation.
All the rules regarding generated ids in put()
apply.
Note that the iteration order of the return value will be the same as the order of the parameter.
put
in interface Objectify
objs
- must all be objects of registered entity type
DatastoreService.put(Iterable)
public <T> java.util.Map<Key<T>,T> put(T... objs)
Objectify
put
in interface Objectify
public void delete(java.lang.Object... keysOrEntities)
Objectify
delete
in interface Objectify
keysOrEntities
- can be Key>s, datastore Keys, or pojo entities.
If it includes entities, only the id fields are relevant.public void delete(java.lang.Iterable<?> keysOrEntities)
Objectify
delete
in interface Objectify
keysOrEntities
- can contain any mix of Key>, datastore Key, or pojo
entities. They need not be of the same type. If a pojo is used, only its
id fields are relevant.DatastoreService.delete(Iterable)
public <T> void delete(java.lang.Class<T> clazz, long id)
Objectify
delete
in interface Objectify
public <T> void delete(java.lang.Class<T> clazz, java.lang.String name)
Objectify
delete
in interface Objectify
public <T> Query<T> query()
Objectify
Create a typesafe query across all kinds of entities.
query
in interface Objectify
public <T> Query<T> query(java.lang.Class<T> clazz)
Objectify
Create a typesafe query across one specific kind of entity.
query
in interface Objectify
public com.google.appengine.api.datastore.Transaction getTxn()
Objectify
Get the underlying transaction object associated with this Objectify instance.
Note that this is *not* the same as DatastoreService.getCurrentTransaction()
,
which uses implicit transaction management. Objectify does not use implicit (thread
local) transactions.
getTxn
in interface Objectify
public ObjectifyFactory getFactory()
Objectify
getFactory
in interface Objectify
public AsyncObjectify async()
Objectify
async
in interface Objectify
public com.google.appengine.api.datastore.DatastoreService getDatastore()
Objectify
Obtain a DatastoreService with parameters roughly equivalent to this Objectify instance.
This should not normally be necessary. It allows you to work with raw Entity objects, allocate ids, and examine thread local transactions.
Note that Objectify does not actually use this DatastoreService in any way; all requests go through an AsyncDatastoreService. Also, even Google's DatastoreService implementation is just a facade around AsyncDatastoreService.
getDatastore
in interface Objectify
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |