@Test public void convertToShort() throws Exception { int i = Short.MAX_VALUE; int negI = Short.MIN_VALUE; Short out = converter.toShort(i); assertNotNull(out); assertEquals(i, out.intValue()); out = converter.toShort(negI); assertNotNull(out); assertEquals(negI, out.intValue()); }
@AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Integer value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { throw new AtlasConversionException( String.format("Integer %s is greater than Short.MAX_VALUE or less than Short.MIN_VALUE", value)); } return value.shortValue(); }
IntegerConverter implements AtlasConverter<Integer> { @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Integer value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { throw new AtlasConversionException( String.format("Integer %s is greater than Short.MAX_VALUE or less than Short.MIN_VALUE", value)); } return value.shortValue(); } }
IntegerConverter implements AtlasConverter<Integer> { @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Integer value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { throw new AtlasConversionException( String.format("Integer %s is greater than Short.MAX_VALUE or less than Short.MIN_VALUE", value)); } return value.shortValue(); }  }
IntegerConverter implements AtlasConverter<Integer> { @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Integer value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { throw new AtlasConversionException( String.format("Integer %s is greater than Short.MAX_VALUE or less than Short.MIN_VALUE", value)); } return value.shortValue(); }  @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DECIMAL) BigDecimal toBigDecimal(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.BIG_INTEGER) BigInteger toBigInteger(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) Boolean toBoolean(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) Byte toByte(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) Character toCharacter(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DATE_TIME) Date toDate(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DOUBLE) Double toDouble(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.FLOAT, concerns = AtlasConversionConcern.RANGE) Float toFloat(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.INTEGER) Integer toInteger(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DATE) LocalDate toLocalDate(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.TIME) LocalTime toLocalTime(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DATE_TIME) LocalDateTime toLocalDateTime(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.LONG) Long toLong(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) Short toShort(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.STRING) String toString(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.NUMBER) Number toNumber(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DATE_TIME_TZ) ZonedDateTime toZonedDateTime(Integer value); }
IntegerConverter implements AtlasConverter<Integer> { @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Integer value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { throw new AtlasConversionException( String.format("Integer %s is greater than Short.MAX_VALUE or less than Short.MIN_VALUE", value)); } return value.shortValue(); }  @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DECIMAL) BigDecimal toBigDecimal(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.BIG_INTEGER) BigInteger toBigInteger(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) Boolean toBoolean(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) Byte toByte(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) Character toCharacter(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DATE_TIME) Date toDate(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DOUBLE) Double toDouble(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.FLOAT, concerns = AtlasConversionConcern.RANGE) Float toFloat(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.INTEGER) Integer toInteger(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DATE) LocalDate toLocalDate(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.TIME) LocalTime toLocalTime(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DATE_TIME) LocalDateTime toLocalDateTime(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.LONG) Long toLong(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) Short toShort(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.STRING) String toString(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.NUMBER) Number toNumber(Integer value); @AtlasConversionInfo(sourceType = FieldType.INTEGER, targetType = FieldType.DATE_TIME_TZ) ZonedDateTime toZonedDateTime(Integer value);  }