public static Class<?> getExpectedType(Class<?> aClass, Name aName) { // TODO: probably need some checks here, e.g. number of params? Class<?> _type = getAccessorMethod(aClass, aName).getReturnType(); if (_type.isInterface()) { return maybeConvertToProxy(_type); } else { return _type; } }
@Override @SuppressWarnings("rawtypes") public Builder<T> newBuilder() { List<Builder<?>> _nested = new ArrayList<Builder<?>>(); Class<?> _attachTo = ReflectorFactory.maybeConvertToProxy((intermediate != null) ? intermediate : aType); for (Content<?> _c : content) { _c.onAttach(_attachTo, reflector, JsonDocumentDefinition.this); _nested.add(_c.newBuilder()); } return new ReflectiveBuilder( Name.MISSING, aType, intermediate, converter, reflector.newReflector(), _nested, false); } };
public void onAttach(Class<?> aContainerType, ReflectorFactory aReflector, ConverterRegistry aConverters) { if ((intermediate != null) && (converter == null)) converter = (Converter<?,R>)aConverters.getConverter(intermediate, type); Class<?> _attachTo = ReflectorFactory.maybeConvertToProxy((intermediate != null) ? intermediate : type); for (Content _c : content) _c.onAttach(_attachTo, reflector, aConverters); aReflector.prepare(aContainerType, name, _attachTo); }
public void onAttach(Class<?> aContainerType, ReflectorFactory aReflector, ConverterRegistry aConverters) { Content<?> _def = JsonDocumentDefinition.firstNonNull(obj, property, array); if (type.isInterface()) { intermediate = ArrayList.class; converter = aConverters.getConverter(ArrayList.class, type); aReflector.prepare(aContainerType, name, intermediate); _def.onAttach(intermediate, reflector, aConverters); } else { Class<?> _type = ReflectorFactory.maybeConvertToProxy(type); aReflector.prepare(aContainerType, name, _type); _def.onAttach(_type, reflector, aConverters); } }