@Test(expected = AtlasConversionException.class) public void convertToByteGreaterThanMAX() throws Exception { String s = "128"; converter.toByte(s); }
@AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.FORMAT, AtlasConversionConcern.FRACTIONAL_PART}) public Byte toByte(String value) throws AtlasConversionException { if (value == null) { return null; } try { return Byte.parseByte(value); } catch (NumberFormatException nfex) { try { BigDecimal bd = new BigDecimal(value); if (bd.compareTo(new BigDecimal(Byte.MIN_VALUE)) < 0 || bd.compareTo(new BigDecimal(Byte.MAX_VALUE)) > 0) { throw new AtlasConversionException(String .format("String %s is greater than Byte.MAX_VALUE or less than Byte.MIN_VALUE", value)); } return bd.byteValue(); } catch (NumberFormatException nfe2) { throw new AtlasConversionException(String .format("String %s cannont be converted to a Byte as it is not in a numerical format", value)); } } }
StringConverter implements AtlasConverter<String> { @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.FORMAT, AtlasConversionConcern.FRACTIONAL_PART}) public Byte toByte(String value) throws AtlasConversionException { if (value == null) { return null; } try { return Byte.parseByte(value); } catch (NumberFormatException nfex) { try { BigDecimal bd = new BigDecimal(value); if (bd.compareTo(new BigDecimal(Byte.MIN_VALUE)) < 0 || bd.compareTo(new BigDecimal(Byte.MAX_VALUE)) > 0) { throw new AtlasConversionException(String .format("String %s is greater than Byte.MAX_VALUE or less than Byte.MIN_VALUE", value)); } return bd.byteValue(); } catch (NumberFormatException nfe2) { throw new AtlasConversionException(String .format("String %s cannont be converted to a Byte as it is not in a numerical format", value)); } } } }
StringConverter implements AtlasConverter<String> { @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.FORMAT, AtlasConversionConcern.FRACTIONAL_PART}) public Byte toByte(String value) throws AtlasConversionException { if (value == null) { return null; } try { return Byte.parseByte(value); } catch (NumberFormatException nfex) { try { BigDecimal bd = new BigDecimal(value); if (bd.compareTo(new BigDecimal(Byte.MIN_VALUE)) < 0 || bd.compareTo(new BigDecimal(Byte.MAX_VALUE)) > 0) { throw new AtlasConversionException(String .format("String %s is greater than Byte.MAX_VALUE or less than Byte.MIN_VALUE", value)); } return bd.byteValue(); } catch (NumberFormatException nfe2) { throw new AtlasConversionException(String .format("String %s cannont be converted to a Byte as it is not in a numerical format", value)); } } }  }
StringConverter implements AtlasConverter<String> { @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.FORMAT, AtlasConversionConcern.FRACTIONAL_PART}) public Byte toByte(String value) throws AtlasConversionException { if (value == null) { return null; } try { return Byte.parseByte(value); } catch (NumberFormatException nfex) { try { BigDecimal bd = new BigDecimal(value); if (bd.compareTo(new BigDecimal(Byte.MIN_VALUE)) < 0 || bd.compareTo(new BigDecimal(Byte.MAX_VALUE)) > 0) { throw new AtlasConversionException(String .format("String %s is greater than Byte.MAX_VALUE or less than Byte.MIN_VALUE", value)); } return bd.byteValue(); } catch (NumberFormatException nfe2) { throw new AtlasConversionException(String .format("String %s cannont be converted to a Byte as it is not in a numerical format", value)); } } }  @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DECIMAL, concerns = AtlasConversionConcern.FORMAT) BigDecimal toBigDecimal(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BIG_INTEGER, concerns = AtlasConversionConcern.FORMAT) BigInteger toBigInteger(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BOOLEAN, concerns = AtlasConversionConcern.CONVENTION) Boolean toBoolean(String value, String sourceFormat, String targetFormat); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.FORMAT, AtlasConversionConcern.FRACTIONAL_PART}) Byte toByte(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.CHAR, concerns = AtlasConversionConcern.RANGE) Character toCharacter(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DATE_TIME) Date toDate(String date, String sourceFormat, String targetFormat); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DOUBLE, concerns = { AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE }) Double toDouble(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.FLOAT, concerns = { AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE }) Float toFloat(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.INTEGER, concerns = { AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE, AtlasConversionConcern.FRACTIONAL_PART }) Integer toInteger(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DATE) LocalDate toLocalDate(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.TIME) LocalTime toLocalTime(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DATE_TIME) LocalDateTime toLocalDateTime(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.LONG, concerns = { AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE, AtlasConversionConcern.FRACTIONAL_PART }) Long toLong(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.SHORT, concerns = { AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE, AtlasConversionConcern.FRACTIONAL_PART }) Short toShort(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.STRING) String toString(String value, String sourceFormat, String targetFormat); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.NUMBER, concerns = { AtlasConversionConcern.FORMAT }) Number toNumber(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DATE_TIME_TZ) ZonedDateTime toZonedDateTime(String value); }
StringConverter implements AtlasConverter<String> { @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.FORMAT, AtlasConversionConcern.FRACTIONAL_PART}) public Byte toByte(String value) throws AtlasConversionException { if (value == null) { return null; } try { return Byte.parseByte(value); } catch (NumberFormatException nfex) { try { BigDecimal bd = new BigDecimal(value); if (bd.compareTo(new BigDecimal(Byte.MIN_VALUE)) < 0 || bd.compareTo(new BigDecimal(Byte.MAX_VALUE)) > 0) { throw new AtlasConversionException(String .format("String %s is greater than Byte.MAX_VALUE or less than Byte.MIN_VALUE", value)); } return bd.byteValue(); } catch (NumberFormatException nfe2) { throw new AtlasConversionException(String .format("String %s cannont be converted to a Byte as it is not in a numerical format", value)); } } }  @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DECIMAL, concerns = AtlasConversionConcern.FORMAT) BigDecimal toBigDecimal(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BIG_INTEGER, concerns = AtlasConversionConcern.FORMAT) BigInteger toBigInteger(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BOOLEAN, concerns = AtlasConversionConcern.CONVENTION) Boolean toBoolean(String value, String sourceFormat, String targetFormat); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.FORMAT, AtlasConversionConcern.FRACTIONAL_PART}) Byte toByte(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.CHAR, concerns = AtlasConversionConcern.RANGE) Character toCharacter(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DATE_TIME) Date toDate(String date, String sourceFormat, String targetFormat); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DOUBLE, concerns = { AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE }) Double toDouble(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.FLOAT, concerns = { AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE }) Float toFloat(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.INTEGER, concerns = { AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE, AtlasConversionConcern.FRACTIONAL_PART }) Integer toInteger(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DATE) LocalDate toLocalDate(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.TIME) LocalTime toLocalTime(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DATE_TIME) LocalDateTime toLocalDateTime(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.LONG, concerns = { AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE, AtlasConversionConcern.FRACTIONAL_PART }) Long toLong(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.SHORT, concerns = { AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE, AtlasConversionConcern.FRACTIONAL_PART }) Short toShort(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.STRING) String toString(String value, String sourceFormat, String targetFormat); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.NUMBER, concerns = { AtlasConversionConcern.FORMAT }) Number toNumber(String value); @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.DATE_TIME_TZ) ZonedDateTime toZonedDateTime(String value);  }