/** * Create a tablename from a given class */ public static String makeTableNameFromClass(Class<?> pClass) { String tableName = null; // try to get from class annotations first ClassFields<?> classFields = ReflectUtils.getInstance().analyzeClass(pClass); if (classFields.getClassAnnotations().contains(PersistentTableName.class)) { for (Annotation classAnnote : classFields.getClassAnnotations()) { if (PersistentTableName.class.equals(classAnnote.annotationType())) { tableName = ((PersistentTableName)classAnnote).value(); break; } } } if (tableName == null) { String name = pClass.getSimpleName(); tableName = makeDBNameFromCamelCase(name); if (tableName.startsWith("_") && tableName.length() > 1) { tableName = tableName.substring(1); } } return tableName; }
if (classFields.getClassAnnotations().contains(PersistentColumnMappingPolicy.class)) { for (Annotation classAnnote : classFields.getClassAnnotations()) { if (PersistentColumnMappingPolicy.class.equals(classAnnote.annotationType())) { MappingPolicy mp = ((PersistentColumnMappingPolicy)classAnnote).policy();