|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.TreeMap
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
|
| 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, entity, localized, userContext |
| 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. |
protected java.lang.reflect.Method |
findMethod(java.lang.String name,
java.lang.Class[] args)
Tries to find a named method in the external object |
java.lang.Object |
get(java.lang.Object key)
Wrapper generic getter: tries first to get the property from the wrapped object, and falls back to the superclass if not found. |
java.lang.Object |
getExternal(java.lang.Object key)
External getter: get a value on the external object |
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.Object key,
java.lang.Object value)
Wrapper generic setter: tries first to set the property into the wrapped object, and falls back to the superclass if not found. |
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 |
|---|
equals, getEntity, getInternal, getKeys, getPrimaryKey, handleSQLException, initialize, setUserContext, validate |
| Methods inherited from class java.util.TreeMap |
|---|
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, headMap, keySet, lastKey, putAll, remove, size, subMap, tailMap, values |
| Methods inherited from class java.util.AbstractMap |
|---|
hashCode, isEmpty, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface velosurf.sql.ReadOnlyMap |
|---|
keySet |
| 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 object| Method Detail |
|---|
public java.lang.Object get(java.lang.Object key)
get in interface java.util.Mapget in interface ReadOnlyMapget in class Instancekey - key of the property to be returned
public java.lang.Object getExternal(java.lang.Object key)
getExternal in class Instancekey - key of the property to be returned
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mapput in class Instancekey - 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 Instancetrue if successfull, false if an error
occurs (in which case $db.lastError 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 Instancevalues - values to be used for the update
true if successfull, false if an error
occurs (in which case $db.lastError can be checked).public boolean delete()
Velosurf will ensure all key columns are specified, to avoid an accidental massive update.
delete in class Instancetrue if successfull, false if an error
occurs (in which case $db.lastError can be checked).public boolean insert()
insert in class Instancetrue if successfull, false if an error
occurs (in which case $db.lastError can be checked).public java.lang.Object unwrap()
protected java.lang.reflect.Method findMethod(java.lang.String name,
java.lang.Class[] args)
name - the name of the methodargs - the types of the arguments
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||