|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap<K,V> java.util.TreeMap<java.lang.String,java.lang.Object> velosurf.context.Instance velosurf.context.ExternalObjectWrapper
public class ExternalObjectWrapper
This wrapper allows one to specify custom mapping objects that don't inherit from Instance.
For now, the introspection is rather basic but may work for standard getters without ambiguity.
Nested Class Summary | |
---|---|
private static class |
ExternalObjectWrapper.ClassInfo
This private class gathers informations on the class of wrapped objects. |
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Field Summary | |
---|---|
(package private) ExternalObjectWrapper.ClassInfo |
classInfo
Info on the wrapped object class. |
(package private) static java.util.Map<java.lang.String,ExternalObjectWrapper.ClassInfo> |
classInfoMap
A map of class infos. |
(package private) java.util.Map |
getterCache
A cache for the wrapped object getter methods. |
(package private) java.util.Map |
setterCache
A cache for the wrapped object setter methods. |
(package private) java.lang.Object |
wrapped
The wrapped object. |
Fields inherited from class velosurf.context.Instance |
---|
db, dirtyFlags, entity |
Constructor Summary | |
---|---|
ExternalObjectWrapper(Entity entity,
java.lang.Object object)
Builds a new PlaiObjectWrapper. |
Method Summary | |
---|---|
boolean |
delete()
Tries to delete the row associated with this Instance using a delete() method in the external object. |
java.lang.Object |
get(java.lang.Object key)
Wrapper generic getter. |
java.lang.Object |
getExternal(java.lang.Object key)
External getter. |
boolean |
insert()
Tries to insert a new row corresponding to this Instance using an insert() method in the external object. |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value)
Wrapper generic setter. |
java.lang.Object |
unwrap()
Returns the underlying external object. |
boolean |
update()
Try to update the row associated with this Instance using an update() method in the external object. |
boolean |
update(java.util.Map values)
Try to update the row associated with this Instance using an update(map) method in the external object. |
Methods inherited from class velosurf.context.Instance |
---|
containsKey, equals, getEntity, getInternal, getPrimaryKey, getWithParams, initialize, remove, resolveName, setClean, setColumnValues, toString, upsert, upsert, validate |
Methods inherited from class java.util.TreeMap |
---|
ceilingEntry, ceilingKey, clear, clone, comparator, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, putAll, size, subMap, subMap, tailMap, tailMap, values |
Methods inherited from class java.util.AbstractMap |
---|
hashCode, isEmpty |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
hashCode, isEmpty |
Field Detail |
---|
java.lang.Object wrapped
ExternalObjectWrapper.ClassInfo classInfo
static java.util.Map<java.lang.String,ExternalObjectWrapper.ClassInfo> classInfoMap
java.util.Map getterCache
java.util.Map setterCache
Constructor Detail |
---|
public ExternalObjectWrapper(Entity entity, java.lang.Object object)
entity
- the related entityobject
- target objectMethod Detail |
---|
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,java.lang.Object>
get
in class Instance
key
- key of the property to be returned
public java.lang.Object getExternal(java.lang.Object key)
getExternal
in class Instance
key
- key of the property to be returned
public java.lang.Object put(java.lang.String key, java.lang.Object value)
put
in interface java.util.Map<java.lang.String,java.lang.Object>
put
in class Instance
key
- key of the property to be setvalue
- corresponding value
public boolean update()
Try to update the row associated with this Instance using an update() method in the external object.
update
in class Instance
true
if successfull, false
if an error
occurs (in which case $db.error can be checked).public boolean update(java.util.Map values)
Try to update the row associated with this Instance using an update(map) method in the external object.
update
in class Instance
values
- values to be used for the update
true
if successfull, false
if an error
occurs (in which case $db.error can be checked).public boolean delete()
Tries to delete the row associated with this Instance using a delete() method in the external object. Velosurf will ensure all key columns are specified, to avoid an accidental massive update.
delete
in class Instance
true
if successfull, false
if an error
occurs (in which case $db.error can be checked).public boolean insert()
insert
in class Instance
true
if successfull, false
if an error
occurs (in which case $db.error can be checked).public java.lang.Object unwrap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |