mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-12-21 23:08:52 -05:00
More enum support
This commit is contained in:
parent
a6c5fc7b52
commit
ba7fb733b2
@ -93,6 +93,10 @@ public class CompileTimeResultSetMapper {
|
||||
toArray(w, keys, componentType, maxRows, cal, cleaner, reflectionFields);
|
||||
} else if (types.isAssignable(returnTypeMirror, collectionType)) {
|
||||
final List<? extends TypeMirror> typeArguments = ((DeclaredType) returnTypeMirror).getTypeArguments();
|
||||
if(typeArguments.isEmpty()) {
|
||||
JdbcMapperProcessor.getMessager().printMessage(Diagnostic.Kind.ERROR, "Collection type must have a generic type argument", eeMethod);
|
||||
return true;
|
||||
}
|
||||
toCollection(w, keys, returnTypeMirror, typeArguments.get(0), maxRows, cal, cleaner, reflectionFields);
|
||||
} else if (types.isAssignable(returnTypeMirror, mapType) && eeMethod.getAnnotation(JdbcMapper.SingleRow.class) == null) {
|
||||
final List<? extends TypeMirror> typeArguments = ((DeclaredType) returnTypeMirror).getTypeArguments();
|
||||
|
@ -729,7 +729,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
// we are going to put most common ones up top so it should execute faster normally
|
||||
// todo: avoid string concat here
|
||||
if (method == null)
|
||||
if (o.getKind().isPrimitive() || types.isAssignable(o, stringType) || types.isAssignable(o, numberType)) {
|
||||
if (o.getKind().isPrimitive() || types.isAssignable(o, stringType) || types.isAssignable(o, numberType) || types.isAssignable(o, enumType)) {
|
||||
method = "Object";
|
||||
// java.util.Date support, put it in a Timestamp
|
||||
} else if (types.isAssignable(o, utilDateType)) {
|
||||
|
@ -127,7 +127,7 @@ public class SimpleSQLChecker implements SQLChecker {
|
||||
}
|
||||
// end special behavior
|
||||
// we are going to put most common ones up top so it should execute faster normally
|
||||
if (types.isAssignable(o, stringType)) {
|
||||
if (types.isAssignable(o, stringType) || types.isAssignable(o, enumType)) { // todo: hack for enum, might try to get one of the options? is it even possible?
|
||||
return defaultString;
|
||||
} else if (o.getKind().isPrimitive() || types.isAssignable(o, numberType)) {
|
||||
switch (o.getKind()) {
|
||||
|
Loading…
Reference in New Issue
Block a user