Beispiel #1
0
  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
            + "'.");
  }
Beispiel #2
0
 public static String getTableName(Class hqlType) {
   MidPointNamingStrategy namingStrategy = new MidPointNamingStrategy();
   return namingStrategy.classToTableName(hqlType.getSimpleName());
 }