public static <T extends SchemaEnum> T getRepoEnumValue(Object object, Class<T> type) { if (object == null) { return null; } Object[] values = type.getEnumConstants(); for (Object value : values) { T schemaEnum = (T) value; if (schemaEnum.getSchemaValue().equals(object)) { return schemaEnum; } } throw new IllegalArgumentException( "Unknown value '" + object + "' of type '" + object.getClass() + "', can't translate to '" + type + "'."); }
public static String getTableName(Class hqlType) { MidPointNamingStrategy namingStrategy = new MidPointNamingStrategy(); return namingStrategy.classToTableName(hqlType.getSimpleName()); }