ClassTypeInfo beanTypeInfo,
String name,
TypeInfo typeInfo,
MethodInfo getter,
MethodInfo setter) {
TypeInfo resolvedTI = beanTypeInfo.resolve(typeInfo);
if (resolvedTI instanceof ParameterizedTypeInfo) {
ParameterizedTypeInfo parameterizedTI = (ParameterizedTypeInfo)resolvedTI;
TypeInfo rawTI = parameterizedTI.getRawType();
if (rawTI instanceof ClassTypeInfo) {
ClassTypeInfo rawClassTI = (ClassTypeInfo)rawTI;
String rawClassName = rawClassTI.getName();
if (rawClassName.equals("java.util.Collection") || rawClassName.equals("java.util.List")) {
TypeInfo elementTV = parameterizedTI.getTypeArguments().get(0);
ClassTypeInfo elementTI = resolveClass(beanTypeInfo, elementTV);
if (elementTI != null) {
ValueInfo resolvedElementTI = createValue(elementTI, getter, setter);
if (rawClassName.equals("java.util.Collection")) {
return new CollectionPropertyInfo<ValueInfo>(
name,
resolvedElementTI,
getter,
setter);
} else {
return new ListPropertyInfo<ValueInfo>(
name,
resolvedElementTI,
getter,
setter);
}
}
} else if (rawClassName.equals("java.util.Map")) {
TypeInfo elementTV = parameterizedTI.getTypeArguments().get(1);
ClassTypeInfo elementTI = resolveClass(beanTypeInfo, elementTV);
if (elementTI != null) {
ValueInfo resolvedElementTI = createValue(elementTI, getter, setter);
TypeInfo keyTV = parameterizedTI.getTypeArguments().get(0);
ClassTypeInfo keyTI = resolveClass(beanTypeInfo, keyTV);
if (keyTI != null) {
ValueInfo resolvedKeyTI = createValue(keyTI, getter, setter);
return new MapPropertyInfo<ValueInfo, ValueInfo>(
name,
resolvedElementTI,
resolvedKeyTI,
getter,
setter);
}
}
}
}
} else if (resolvedTI instanceof ClassTypeInfo) {
ValueInfo resolved = createValue((ClassTypeInfo)resolvedTI, getter, setter);
return new SingleValuedPropertyInfo<ValueInfo>(
name,
resolved,
getter,
setter);
} else if (resolvedTI instanceof ArrayTypeInfo) {
TypeInfo componentTI = ((ArrayTypeInfo)resolvedTI).getComponentType();
if (componentTI instanceof ClassTypeInfo) {
ClassTypeInfo rawComponentTI = (ClassTypeInfo)componentTI;
ValueInfo resolved = createValue(rawComponentTI, getter, setter);
if (resolved instanceof SimpleValueInfo) {
return new ArrayPropertyInfo<SimpleValueInfo>(name, (SimpleValueInfo)resolved, getter, setter);