use of com.bluelinelabs.logansquare.processor.type.collection.ArrayCollectionType in project LoganSquare by bluelinelabs.
the class Type method typeFor.
public static Type typeFor(TypeMirror typeMirror, TypeMirror typeConverterType, Elements elements, Types types) {
TypeMirror genericClassTypeMirror = types.erasure(typeMirror);
boolean hasTypeConverter = typeConverterType != null && !typeConverterType.toString().equals("void");
Type type;
if (!hasTypeConverter && typeMirror instanceof ArrayType) {
TypeMirror arrayTypeMirror = ((ArrayType) typeMirror).getComponentType();
type = new ArrayCollectionType(Type.typeFor(arrayTypeMirror, null, elements, types));
} else if (!hasTypeConverter && !genericClassTypeMirror.toString().equals(typeMirror.toString())) {
type = CollectionType.collectionTypeFor(typeMirror, genericClassTypeMirror, elements, types);
if (type == null) {
if (typeMirror.toString().contains("?")) {
throw new RuntimeException("Generic types with wildcards are currently not supported by LoganSquare.");
}
try {
type = new ParameterizedTypeField(TypeName.get(typeMirror));
} catch (Exception ignored) {
}
}
} else {
type = FieldType.fieldTypeFor(typeMirror, typeConverterType, elements, types);
}
return type;
}
Aggregations