@SuppressWarnings("unchecked")
public <T> MetaIdField<T> processId(DboTableMeta t, Field field, MetaAbstractClass<T> metaClass) {
Method idMethod = getIdMethod(field);
NoSqlId idAnno = field.getAnnotation(NoSqlId.class);
MetaIdField<T> metaField = idMetaProvider.get();
KeyGenerator gen = null;
if(idAnno.usegenerator()) {
Class<? extends KeyGenerator> generation = idAnno.generation();
gen = ReflectionUtil.create(generation);
}
Class<?> type = field.getType();
Converter converter = null;
if(!NoConversion.class.isAssignableFrom(idAnno.customConverter()))
converter = ReflectionUtil.create(idAnno.customConverter());
String columnName = field.getName();
if(!"".equals(idAnno.columnName()))
columnName = idAnno.columnName();
boolean isIndexed = false;
if(field.isAnnotationPresent(NoSqlIndexed.class))
isIndexed = true;
if(field.isAnnotationPresent(NoSqlPartitionByThisField.class))
throw new IllegalArgumentException("Field="+field+" is a primary key so it cannot have annotation="+NoSqlPartitionByThisField.class.getName());
try {
converter = lookupConverter(type, converter);
IdInfo info = new IdInfo();
info.setIdMethod(idMethod);
info.setConverter(converter);
info.setGen(gen);
info.setUseGenerator(idAnno.usegenerator());
info.setMetaClass(metaClass);
metaField.setup(t, info, field, columnName, isIndexed);
return metaField;
} catch(IllegalArgumentException e) {
throw new IllegalArgumentException("No converter found for field='"+field.getName()+"' in class="