public interface RLiveObjectService
Modifier and Type | Method and Description |
---|---|
<T> RLiveObject |
asLiveObject(T instance)
To cast the instance to RLiveObject instance.
|
<T> RExpirable |
asRExpirable(T instance)
To cast the instance to RExpirable instance.
|
<T,K,V> RMap<K,V> |
asRMap(T instance)
To cast the instance to RMap instance.
|
<T> T |
attach(T detachedObject)
Returns proxied object for the detached object.
|
<T> boolean |
delete(Class<T> entityClass,
Object id)
Deletes object by class and id including all nested objects.
|
<T> void |
delete(T attachedObject)
Deletes attached object including all nested objects.
|
<T> T |
detach(T attachedObject)
Returns unproxied detached object for the attached object.
|
<T> Collection<T> |
find(Class<T> entityClass,
Condition condition)
Finds the entities matches specified
condition . |
<T> T |
get(Class<T> entityClass,
Object id)
Finds the entity from Redis with the id.
|
boolean |
isClassRegistered(Class<?> cls)
Check if the class is registered in the cache.
|
<T> boolean |
isExists(T instance)
Returns true if the RLiveObject already exists in redis.
|
<T> boolean |
isLiveObject(T instance)
Returns true if the instance is a instance of RLiveObject.
|
<T> T |
merge(T detachedObject)
Returns proxied object for the detached object.
|
<T> T |
persist(T detachedObject)
Returns proxied attached object for the detached object.
|
void |
registerClass(Class<?> cls)
Pre register the class with the service, registering all the classes on
startup can speed up the instance creation.
|
void |
unregisterClass(Class<?> cls)
Unregister the class with the service.
|
<T> T get(Class<T> entityClass, Object id)
T
- Entity typeentityClass
- - entity classid
- identifier<T> Collection<T> find(Class<T> entityClass, Condition condition)
condition
.
Usage example:
Collection objects = liveObjectService.find(MyObject.class, Conditions.or(Conditions.in("field", "value1", "value2"), Conditions.and(Conditions.eq("field2", "value2"), Conditions.eq("field3", "value5"))));
entityClass
- - entity classcondition
- - condition objectConditions
<T> T attach(T detachedObject)
T
- Entity typedetachedObject
- - not proxied objectIllegalArgumentException
- if the object is is a RLiveObject instance.<T> T merge(T detachedObject)
T
- Entity typedetachedObject
- - not proxied objectIllegalArgumentException
- if the object is is a RLiveObject instance.<T> T persist(T detachedObject)
T
- Entity typedetachedObject
- - not proxied object<T> T detach(T attachedObject)
T
- Entity typeattachedObject
- - proxied object<T> void delete(T attachedObject)
T
- Entity typeattachedObject
- - proxied object<T> boolean delete(Class<T> entityClass, Object id)
T
- Entity typeentityClass
- - object classid
- - object idtrue
if entity was deleted successfully, false
otherwise<T> RLiveObject asLiveObject(T instance)
T
- type of instanceinstance
- - live object<T> RExpirable asRExpirable(T instance)
T
- type of instanceinstance
- - live object<T,K,V> RMap<K,V> asRMap(T instance)
T
- type of instanceK
- type of keyV
- type of valueinstance
- - live object<T> boolean isLiveObject(T instance)
T
- type of instanceinstance
- - live objecttrue
object is RLiveObject<T> boolean isExists(T instance)
T
- type of instanceinstance
- - live objecttrue
object existsvoid registerClass(Class<?> cls)
cls
- - classvoid unregisterClass(Class<?> cls)
cls
- It can be either the proxied class or the unproxied conterpart.boolean isClassRegistered(Class<?> cls)
cls
- - type of instancetrue
if class already registeredCopyright © 2014–2019 The Redisson Project. All rights reserved.