mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-11-25 10:22:17 -05:00
Set in list type names in a smarter fashion
This commit is contained in:
parent
c1139447e4
commit
f028853c15
@ -129,12 +129,5 @@ public interface JdbcMapper extends Closeable {
|
||||
this.arrayNumberTypeName = arrayNumberTypeName;
|
||||
this.arrayStringTypeName = arrayStringTypeName;
|
||||
}
|
||||
|
||||
public DatabaseType nonDefault(final DatabaseType def) {
|
||||
if(this != DEFAULT)
|
||||
return this;
|
||||
//return def == DEFAULT ? STANDARD : def;
|
||||
return def; // we guarantee this to be not DEFAULT in JdbcMapperProcessor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
|
||||
private Types types;
|
||||
private TypeMirror sqlExceptionType, stringType, numberType, utilDateType, readerType, clobType,
|
||||
byteArrayType, inputStreamType, fileType, blobType, sqlArrayType, collectionType
|
||||
;
|
||||
byteArrayType, inputStreamType, fileType, blobType, sqlArrayType, collectionType;
|
||||
private JdbcMapper.DatabaseType defaultDatabaseType;
|
||||
private String defaultArrayNumberTypeName, defaultArrayStringTypeName;
|
||||
|
||||
@ -88,9 +87,19 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
}
|
||||
final TypeElement genClass = (TypeElement) element;
|
||||
final JdbcMapper.Mapper mapper = genClass.getAnnotation(JdbcMapper.Mapper.class);
|
||||
final JdbcMapper.DatabaseType databaseType = mapper.databaseType().nonDefault(defaultDatabaseType);
|
||||
final String arrayNumberTypeName = !mapper.arrayNumberTypeName().isEmpty() ? mapper.arrayNumberTypeName() : defaultArrayNumberTypeName;
|
||||
final String arrayStringTypeName = !mapper.arrayStringTypeName().isEmpty() ? mapper.arrayStringTypeName() : defaultArrayStringTypeName;
|
||||
final JdbcMapper.DatabaseType databaseType;
|
||||
final String arrayNumberTypeName, arrayStringTypeName;
|
||||
if (mapper.databaseType() == JdbcMapper.DatabaseType.DEFAULT) {
|
||||
databaseType = defaultDatabaseType;
|
||||
arrayNumberTypeName = !mapper.arrayNumberTypeName().isEmpty() ? mapper.arrayNumberTypeName() : defaultArrayNumberTypeName;
|
||||
arrayStringTypeName = !mapper.arrayStringTypeName().isEmpty() ? mapper.arrayStringTypeName() : defaultArrayStringTypeName;
|
||||
} else {
|
||||
databaseType = mapper.databaseType();
|
||||
arrayNumberTypeName = !mapper.arrayNumberTypeName().isEmpty() ? mapper.arrayNumberTypeName() :
|
||||
(mapper.databaseType() == defaultDatabaseType ? defaultArrayNumberTypeName : mapper.databaseType().arrayNumberTypeName);
|
||||
arrayStringTypeName = !mapper.arrayStringTypeName().isEmpty() ? mapper.arrayStringTypeName() :
|
||||
(mapper.databaseType() == defaultDatabaseType ? defaultArrayStringTypeName : mapper.databaseType().arrayStringTypeName);
|
||||
}
|
||||
final String sqlParserMirror = getSqlParser(mapper).toString();
|
||||
//final SQLParser parser = new SimpleSQLParser();//(SQLParser)Class.forName(mapper.sqlParser().getCanonicalName()).newInstance();
|
||||
//final SQLParser parser = mapper.sqlParser().equals(SQLParser.class) ? new SimpleSQLParser() : mapper.sqlParser().newInstance();
|
||||
|
Loading…
Reference in New Issue
Block a user