@Override public Object getVersion(Object domainObject) { return getTop().getProperty(domainObject, "version"); }
@Override public Object getId(Object domainObject) { return getTop().getProperty(domainObject, "id"); }
@Override public List<Object> loadDomainObjects(List<Class<?>> classes, List<Object> domainIds) { if (classes.size() != domainIds.size()) { die(null, "Size mismatch in paramaters. classes.size() = %d domainIds.size=%d", classes .size(), domainIds.size()); } List<Object> toReturn = new ArrayList<Object>(classes.size()); Iterator<Class<?>> classIt = classes.iterator(); Iterator<Object> idIt = domainIds.iterator(); while (classIt.hasNext()) { toReturn.add(getTop().loadDomainObject(classIt.next(), idIt.next())); } return toReturn; }
/** * Returns <code>true</code> if the given class can be used as an id or * version key. */ private boolean isKeyType(Class<?> domainClass) { if (ValueCodex.canDecode(domainClass)) { return true; } return BaseProxy.class.isAssignableFrom(getTop().resolveClientType(domainClass, BaseProxy.class, true)); } }
@Override public <T> T loadDomainObject(Class<T> clazz, Object id) { if (id == null) { die(null, "Cannot invoke find method with a null id"); } return clazz.cast(getTop().invoke(getFind(clazz), id)); }
@Override public Object getProperty(Object domainObject, String property) { try { Method getter = getTop().getGetter(domainObject.getClass(), property); if (getter == null) { die(null, "Could not determine getter for property %s on type %s", property, domainObject .getClass().getCanonicalName()); } Object value = getter.invoke(domainObject); return value; } catch (IllegalAccessException e) { return die(e, "Could not retrieve property %s", property); } catch (InvocationTargetException e) { return report(e); } }
@Override public void setProperty(Object domainObject, String property, Class<?> expectedType, Object value) { try { Method setter = getTop().getSetter(domainObject.getClass(), property); if (setter == null) { die(null, "Could not locate setter for property %s in type %s", property, domainObject .getClass().getCanonicalName()); } setter.invoke(domainObject, value); return; } catch (IllegalAccessException e) { die(e, "Could not set property %s", property); } catch (InvocationTargetException e) { report(e); } }
@Override public Object getId(Object domainObject) { return getTop().getProperty(domainObject, "id"); }
@Override public Object getVersion(Object domainObject) { return getTop().getProperty(domainObject, "version"); }
@Override public Object getVersion(Object domainObject) { return getTop().getProperty(domainObject, "version"); }
/** * Returns <code>true</code> if the given class can be used as an id or * version key. */ private boolean isKeyType(Class<?> domainClass) { if (ValueCodex.canDecode(domainClass)) { return true; } return BaseProxy.class.isAssignableFrom(getTop().resolveClientType(domainClass, BaseProxy.class, true)); } }
/** * Returns <code>true</code> if the given class can be used as an id or * version key. */ private boolean isKeyType(Class<?> domainClass) { if (ValueCodex.canDecode(domainClass)) { return true; } return BaseProxy.class.isAssignableFrom(getTop().resolveClientType(domainClass, BaseProxy.class, true)); } }
/** * Returns <code>true</code> if the given class can be used as an id or * version key. */ private boolean isKeyType(Class<?> domainClass) { if (ValueCodex.canDecode(domainClass)) { return true; } return BaseProxy.class.isAssignableFrom(getTop().resolveClientType(domainClass, BaseProxy.class, true)); } }
@Override public <T> T loadDomainObject(Class<T> clazz, Object id) { if (id == null) { die(null, "Cannot invoke find method with a null id"); } return clazz.cast(getTop().invoke(getFind(clazz), id)); }
@Override public <T> T loadDomainObject(Class<T> clazz, Object id) { if (id == null) { die(null, "Cannot invoke find method with a null id"); } return clazz.cast(getTop().invoke(getFind(clazz), id)); }
@Override public <T> T loadDomainObject(Class<T> clazz, Object id) { if (id == null) { die(null, "Cannot invoke find method with a null id"); } return clazz.cast(getTop().invoke(getFind(clazz), id)); }