@Test public void testClassFromFieldType() { assertNull(service.classFromFieldType(null)); assertEquals(java.lang.Object.class, service.classFromFieldType(FieldType.ANY)); assertNotNull(service.classFromFieldType(FieldType.BOOLEAN)); assertNotNull(service.classFromFieldType(FieldType.BYTE)); assertNotNull(service.classFromFieldType(FieldType.CHAR)); assertNotNull(service.classFromFieldType(FieldType.DOUBLE)); assertNotNull(service.classFromFieldType(FieldType.FLOAT)); assertNotNull(service.classFromFieldType(FieldType.INTEGER)); assertNotNull(service.classFromFieldType(FieldType.LONG)); assertNotNull(service.classFromFieldType(FieldType.SHORT)); assertNotNull(service.classFromFieldType(FieldType.STRING)); assertNotNull(service.classFromFieldType(FieldType.DATE)); assertNotNull(service.classFromFieldType(FieldType.TIME)); assertNotNull(service.classFromFieldType(FieldType.DATE_TIME)); assertNotNull(service.classFromFieldType(FieldType.DATE_TZ)); assertNotNull(service.classFromFieldType(FieldType.TIME_TZ)); assertNotNull(service.classFromFieldType(FieldType.DATE_TIME_TZ)); assertNull(service.classFromFieldType(FieldType.NONE)); }
@Override public Class<?> classFromFieldType(FieldType fieldType) { if (fieldType == null) { return null; } switch (fieldType) { case ANY: return Object.class; case BIG_INTEGER: return BigInteger.class; case BOOLEAN: return Boolean.class; case BYTE: return Byte.class; case BYTE_ARRAY: return Byte[].class; case CHAR: return java.lang.Character.class; case COMPLEX: return null; case DATE: return java.time.LocalDate.class; case DATE_TIME: return Date.class; case DATE_TZ: case TIME_TZ: case DATE_TIME_TZ: return java.time.ZonedDateTime.class; case DECIMAL: return java.math.BigDecimal.class; case DOUBLE: return java.lang.Double.class; case FLOAT: return java.lang.Float.class; case INTEGER: return java.lang.Integer.class; case LONG: return java.lang.Long.class; case NONE: return null; case NUMBER: return java.lang.Number.class; case SHORT: return java.lang.Short.class; case STRING: return java.lang.String.class; case TIME: return java.time.LocalTime.class; default: throw new IllegalArgumentException( String.format("Unsupported field type '%s': corresponding Java class needs to be added in DefaultAtlasConversionService", fieldType)); } }
DefaultAtlasConversionService implements AtlasConversionService { @Override public Class<?> classFromFieldType(FieldType fieldType) { if (fieldType == null) { return null; } switch (fieldType) { case ANY: return Object.class; case BIG_INTEGER: return BigInteger.class; case BOOLEAN: return Boolean.class; case BYTE: return Byte.class; case BYTE_ARRAY: return Byte[].class; case CHAR: return java.lang.Character.class; case COMPLEX: return null; case DATE: return java.time.LocalDate.class; case DATE_TIME: return Date.class; case DATE_TZ: case TIME_TZ: case DATE_TIME_TZ: return java.time.ZonedDateTime.class; case DECIMAL: return java.math.BigDecimal.class; case DOUBLE: return java.lang.Double.class; case FLOAT: return java.lang.Float.class; case INTEGER: return java.lang.Integer.class; case LONG: return java.lang.Long.class; case NONE: return null; case NUMBER: return java.lang.Number.class; case SHORT: return java.lang.Short.class; case STRING: return java.lang.String.class; case TIME: return java.time.LocalTime.class; default: throw new IllegalArgumentException( String.format("Unsupported field type '%s': corresponding Java class needs to be added in DefaultAtlasConversionService", fieldType)); } } }
DefaultAtlasConversionService implements AtlasConversionService { @Override public Class<?> classFromFieldType(FieldType fieldType) { if (fieldType == null) { return null; } switch (fieldType) { case ANY: return Object.class; case BIG_INTEGER: return BigInteger.class; case BOOLEAN: return Boolean.class; case BYTE: return Byte.class; case BYTE_ARRAY: return Byte[].class; case CHAR: return java.lang.Character.class; case COMPLEX: return null; case DATE: return java.time.LocalDate.class; case DATE_TIME: return Date.class; case DATE_TZ: case TIME_TZ: case DATE_TIME_TZ: return java.time.ZonedDateTime.class; case DECIMAL: return java.math.BigDecimal.class; case DOUBLE: return java.lang.Double.class; case FLOAT: return java.lang.Float.class; case INTEGER: return java.lang.Integer.class; case LONG: return java.lang.Long.class; case NONE: return null; case NUMBER: return java.lang.Number.class; case SHORT: return java.lang.Short.class; case STRING: return java.lang.String.class; case TIME: return java.time.LocalTime.class; default: throw new IllegalArgumentException( String.format("Unsupported field type '%s': corresponding Java class needs to be added in DefaultAtlasConversionService", fieldType)); } } private  DefaultAtlasConversionService(); }
DefaultAtlasConversionService implements AtlasConversionService { @Override public Class<?> classFromFieldType(FieldType fieldType) { if (fieldType == null) { return null; } switch (fieldType) { case ANY: return Object.class; case BIG_INTEGER: return BigInteger.class; case BOOLEAN: return Boolean.class; case BYTE: return Byte.class; case BYTE_ARRAY: return Byte[].class; case CHAR: return java.lang.Character.class; case COMPLEX: return null; case DATE: return java.time.LocalDate.class; case DATE_TIME: return Date.class; case DATE_TZ: case TIME_TZ: case DATE_TIME_TZ: return java.time.ZonedDateTime.class; case DECIMAL: return java.math.BigDecimal.class; case DOUBLE: return java.lang.Double.class; case FLOAT: return java.lang.Float.class; case INTEGER: return java.lang.Integer.class; case LONG: return java.lang.Long.class; case NONE: return null; case NUMBER: return java.lang.Number.class; case SHORT: return java.lang.Short.class; case STRING: return java.lang.String.class; case TIME: return java.time.LocalTime.class; default: throw new IllegalArgumentException( String.format("Unsupported field type '%s': corresponding Java class needs to be added in DefaultAtlasConversionService", fieldType)); } } private  DefaultAtlasConversionService(); static DefaultAtlasConversionService getInstance(); static Set<String> listPrimitiveClassNames(); @Override Optional<AtlasConverter<?>> findMatchingConverter(FieldType source, FieldType target); @Override Optional<AtlasConverter<?>> findMatchingConverter(String sourceClassName, String targetClassName); @Override Object copyPrimitive(Object sourceValue); @Override Object convertType(Object sourceValue, FieldType origSourceType, FieldType targetType); @Override Object convertType(Object sourceValue, String sourceFormat, FieldType targetType, String targetFormat); @Override Object convertType(Object sourceValue, String sourceFormat, Class<?> targetType, String targetFormat); @Override boolean isConvertionAvailableFor(Object sourceValue, Class<?> targetType); @Override Boolean isPrimitive(String className); @Override Boolean isPrimitive(Class<?> clazz); @Override Boolean isPrimitive(FieldType fieldType); @Override Boolean isBoxedPrimitive(Class<?> clazz); @Override Class<?> boxOrUnboxPrimitive(String clazzName); @Override Class<?> boxOrUnboxPrimitive(Class<?> clazz); @Override FieldType fieldTypeFromClass(Class<?> clazz); @Override FieldType fieldTypeFromClass(String className); @Override Class<?> classFromFieldType(FieldType fieldType); @Override Boolean isAssignableFieldType(FieldType source, FieldType target); }
DefaultAtlasConversionService implements AtlasConversionService { @Override public Class<?> classFromFieldType(FieldType fieldType) { if (fieldType == null) { return null; } switch (fieldType) { case ANY: return Object.class; case BIG_INTEGER: return BigInteger.class; case BOOLEAN: return Boolean.class; case BYTE: return Byte.class; case BYTE_ARRAY: return Byte[].class; case CHAR: return java.lang.Character.class; case COMPLEX: return null; case DATE: return java.time.LocalDate.class; case DATE_TIME: return Date.class; case DATE_TZ: case TIME_TZ: case DATE_TIME_TZ: return java.time.ZonedDateTime.class; case DECIMAL: return java.math.BigDecimal.class; case DOUBLE: return java.lang.Double.class; case FLOAT: return java.lang.Float.class; case INTEGER: return java.lang.Integer.class; case LONG: return java.lang.Long.class; case NONE: return null; case NUMBER: return java.lang.Number.class; case SHORT: return java.lang.Short.class; case STRING: return java.lang.String.class; case TIME: return java.time.LocalTime.class; default: throw new IllegalArgumentException( String.format("Unsupported field type '%s': corresponding Java class needs to be added in DefaultAtlasConversionService", fieldType)); } } private  DefaultAtlasConversionService(); static DefaultAtlasConversionService getInstance(); static Set<String> listPrimitiveClassNames(); @Override Optional<AtlasConverter<?>> findMatchingConverter(FieldType source, FieldType target); @Override Optional<AtlasConverter<?>> findMatchingConverter(String sourceClassName, String targetClassName); @Override Object copyPrimitive(Object sourceValue); @Override Object convertType(Object sourceValue, FieldType origSourceType, FieldType targetType); @Override Object convertType(Object sourceValue, String sourceFormat, FieldType targetType, String targetFormat); @Override Object convertType(Object sourceValue, String sourceFormat, Class<?> targetType, String targetFormat); @Override boolean isConvertionAvailableFor(Object sourceValue, Class<?> targetType); @Override Boolean isPrimitive(String className); @Override Boolean isPrimitive(Class<?> clazz); @Override Boolean isPrimitive(FieldType fieldType); @Override Boolean isBoxedPrimitive(Class<?> clazz); @Override Class<?> boxOrUnboxPrimitive(String clazzName); @Override Class<?> boxOrUnboxPrimitive(Class<?> clazz); @Override FieldType fieldTypeFromClass(Class<?> clazz); @Override FieldType fieldTypeFromClass(String className); @Override Class<?> classFromFieldType(FieldType fieldType); @Override Boolean isAssignableFieldType(FieldType source, FieldType target);  }