@Test public void testTranslateToGenericType() { Assertions.assertThat(translator.translateClassToGenericType(javaClass)).isEqualTo(translatedType); }
@Override public String translateClassToGenericType(final Class<?> type) { String fieldType = null; if (type != null) { if (type.isPrimitive()) { if (type == byte.class) { fieldType = DataType.TYPE_NUMERIC_BYTE; } else if (type == double.class) { fieldType = DataType.TYPE_NUMERIC_DOUBLE; } else if (type == float.class) { fieldType = DataType.TYPE_NUMERIC_FLOAT; } else if (type == int.class) { fieldType = DataType.TYPE_NUMERIC_INTEGER; } else if (type == long.class) { fieldType = DataType.TYPE_NUMERIC_LONG; } else if (type == short.class) { fieldType = DataType.TYPE_NUMERIC_SHORT; } else if (type == boolean.class) { fieldType = DataType.TYPE_BOOLEAN; } else if (type == char.class) { fieldType = DataType.TYPE_STRING; } else if (type == void.class) { fieldType = DataType.TYPE_VOID; } } else if (BigDecimal.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BIGDECIMAL; } else if (BigInteger.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BIGINTEGER; } else if (Byte.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BYTE; } else if (Double.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_DOUBLE; } else if (Float.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_FLOAT; } else if (Integer.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_INTEGER; } else if (Long.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_LONG; } else if (Short.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_SHORT; } else if (Boolean.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_BOOLEAN; } else if (String.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_STRING; } else if (Collection.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_COLLECTION; } else if (Date.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_DATE; } else if (LocalDate.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_LOCAL_DATE; } else if (Comparable.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_COMPARABLE; } else { fieldType = type.getName(); } } return fieldType; }
JavaTypeSystemTranslator implements ClassToGenericClassConverter { @Override public String translateClassToGenericType(final Class<?> type) { String fieldType = null; if (type != null) { if (type.isPrimitive()) { if (type == byte.class) { fieldType = DataType.TYPE_NUMERIC_BYTE; } else if (type == double.class) { fieldType = DataType.TYPE_NUMERIC_DOUBLE; } else if (type == float.class) { fieldType = DataType.TYPE_NUMERIC_FLOAT; } else if (type == int.class) { fieldType = DataType.TYPE_NUMERIC_INTEGER; } else if (type == long.class) { fieldType = DataType.TYPE_NUMERIC_LONG; } else if (type == short.class) { fieldType = DataType.TYPE_NUMERIC_SHORT; } else if (type == boolean.class) { fieldType = DataType.TYPE_BOOLEAN; } else if (type == char.class) { fieldType = DataType.TYPE_STRING; } else if (type == void.class) { fieldType = DataType.TYPE_VOID; } } else if (BigDecimal.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BIGDECIMAL; } else if (BigInteger.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BIGINTEGER; } else if (Byte.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BYTE; } else if (Double.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_DOUBLE; } else if (Float.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_FLOAT; } else if (Integer.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_INTEGER; } else if (Long.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_LONG; } else if (Short.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_SHORT; } else if (Boolean.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_BOOLEAN; } else if (String.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_STRING; } else if (Collection.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_COLLECTION; } else if (Date.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_DATE; } else if (LocalDate.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_LOCAL_DATE; } else if (Comparable.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_COMPARABLE; } else { fieldType = type.getName(); } } return fieldType; } }
JavaTypeSystemTranslator implements ClassToGenericClassConverter { @Override public String translateClassToGenericType(final Class<?> type) { String fieldType = null; if (type != null) { if (type.isPrimitive()) { if (type == byte.class) { fieldType = DataType.TYPE_NUMERIC_BYTE; } else if (type == double.class) { fieldType = DataType.TYPE_NUMERIC_DOUBLE; } else if (type == float.class) { fieldType = DataType.TYPE_NUMERIC_FLOAT; } else if (type == int.class) { fieldType = DataType.TYPE_NUMERIC_INTEGER; } else if (type == long.class) { fieldType = DataType.TYPE_NUMERIC_LONG; } else if (type == short.class) { fieldType = DataType.TYPE_NUMERIC_SHORT; } else if (type == boolean.class) { fieldType = DataType.TYPE_BOOLEAN; } else if (type == char.class) { fieldType = DataType.TYPE_STRING; } else if (type == void.class) { fieldType = DataType.TYPE_VOID; } } else if (BigDecimal.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BIGDECIMAL; } else if (BigInteger.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BIGINTEGER; } else if (Byte.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BYTE; } else if (Double.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_DOUBLE; } else if (Float.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_FLOAT; } else if (Integer.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_INTEGER; } else if (Long.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_LONG; } else if (Short.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_SHORT; } else if (Boolean.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_BOOLEAN; } else if (String.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_STRING; } else if (Collection.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_COLLECTION; } else if (Date.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_DATE; } else if (LocalDate.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_LOCAL_DATE; } else if (Comparable.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_COMPARABLE; } else { fieldType = type.getName(); } } return fieldType; }  }
JavaTypeSystemTranslator implements ClassToGenericClassConverter { @Override public String translateClassToGenericType(final Class<?> type) { String fieldType = null; if (type != null) { if (type.isPrimitive()) { if (type == byte.class) { fieldType = DataType.TYPE_NUMERIC_BYTE; } else if (type == double.class) { fieldType = DataType.TYPE_NUMERIC_DOUBLE; } else if (type == float.class) { fieldType = DataType.TYPE_NUMERIC_FLOAT; } else if (type == int.class) { fieldType = DataType.TYPE_NUMERIC_INTEGER; } else if (type == long.class) { fieldType = DataType.TYPE_NUMERIC_LONG; } else if (type == short.class) { fieldType = DataType.TYPE_NUMERIC_SHORT; } else if (type == boolean.class) { fieldType = DataType.TYPE_BOOLEAN; } else if (type == char.class) { fieldType = DataType.TYPE_STRING; } else if (type == void.class) { fieldType = DataType.TYPE_VOID; } } else if (BigDecimal.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BIGDECIMAL; } else if (BigInteger.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BIGINTEGER; } else if (Byte.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BYTE; } else if (Double.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_DOUBLE; } else if (Float.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_FLOAT; } else if (Integer.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_INTEGER; } else if (Long.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_LONG; } else if (Short.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_SHORT; } else if (Boolean.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_BOOLEAN; } else if (String.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_STRING; } else if (Collection.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_COLLECTION; } else if (Date.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_DATE; } else if (LocalDate.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_LOCAL_DATE; } else if (Comparable.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_COMPARABLE; } else { fieldType = type.getName(); } } return fieldType; }  @Override String translateClassToGenericType(final Class<?> type); }
JavaTypeSystemTranslator implements ClassToGenericClassConverter { @Override public String translateClassToGenericType(final Class<?> type) { String fieldType = null; if (type != null) { if (type.isPrimitive()) { if (type == byte.class) { fieldType = DataType.TYPE_NUMERIC_BYTE; } else if (type == double.class) { fieldType = DataType.TYPE_NUMERIC_DOUBLE; } else if (type == float.class) { fieldType = DataType.TYPE_NUMERIC_FLOAT; } else if (type == int.class) { fieldType = DataType.TYPE_NUMERIC_INTEGER; } else if (type == long.class) { fieldType = DataType.TYPE_NUMERIC_LONG; } else if (type == short.class) { fieldType = DataType.TYPE_NUMERIC_SHORT; } else if (type == boolean.class) { fieldType = DataType.TYPE_BOOLEAN; } else if (type == char.class) { fieldType = DataType.TYPE_STRING; } else if (type == void.class) { fieldType = DataType.TYPE_VOID; } } else if (BigDecimal.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BIGDECIMAL; } else if (BigInteger.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BIGINTEGER; } else if (Byte.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_BYTE; } else if (Double.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_DOUBLE; } else if (Float.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_FLOAT; } else if (Integer.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_INTEGER; } else if (Long.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_LONG; } else if (Short.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_NUMERIC_SHORT; } else if (Boolean.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_BOOLEAN; } else if (String.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_STRING; } else if (Collection.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_COLLECTION; } else if (Date.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_DATE; } else if (LocalDate.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_LOCAL_DATE; } else if (Comparable.class.isAssignableFrom(type)) { fieldType = DataType.TYPE_COMPARABLE; } else { fieldType = type.getName(); } } return fieldType; }  @Override String translateClassToGenericType(final Class<?> type);  }