public static Class getNestedPropertyType(DynaClass bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, NoSuchFieldException { // Resolve nested references while (resolver.hasNested(name)) { String next = resolver.next(name); if (resolver.isIndexed(next) || resolver.isMapped(next)) { String property = resolver.getProperty(next); Class<?> clazz = Class.forName(bean.getName()); Class<?> detectTypeParameter = detectTypeParameter(clazz, property, resolver.isIndexed(name) ? 0 : 1); bean = WrapDynaClass.createDynaClass(detectTypeParameter); return getNestedPropertyType(bean, resolver.remove(name)); } DynaProperty db = bean.getDynaProperty(next); bean = WrapDynaClass.createDynaClass(db.getType()); name = resolver.remove(name); } if (resolver.isMapped(name) || resolver.isIndexed(name)) { String property = resolver.getProperty(name); Class<?> clazz = Class.forName(bean.getName()); return detectTypeParameter(clazz, property, resolver.isIndexed(name) ? 0 : 1); } Class<?> type = bean.getDynaProperty(name).getType(); return type; }
private WrapDynaClass getDynaClass(Object reference) { if (dynaClass == null && reference != null) { dynaClass = WrapDynaClass.createDynaClass(reference.getClass()); } return dynaClass; }
public ListContainer(Class<T> type) { backingList = new ArrayList<T>(); dynaClass = WrapDynaClass.createDynaClass(type); }
public ListContainer(Class<T> type, Collection<T> backingList) { dynaClass = WrapDynaClass.createDynaClass(type); setCollection(backingList); }