@Test public void convertToBoolean() { Character c = Character.forDigit(1, 10); Boolean t = converter.toBoolean(c, null, null); assertNotNull(t); assertTrue(t); c = "T".charAt(0); Boolean t2 = converter.toBoolean(c, null, null); assertNotNull(t2); assertTrue(t2); c = "t".charAt(0); Boolean t3 = converter.toBoolean(c, null, null); assertNotNull(t3); assertTrue(t3); c = Character.forDigit(0, 10); Boolean f = converter.toBoolean(c, null, null); assertNotNull(f); assertFalse(f); c = "F".charAt(0); Boolean f2 = converter.toBoolean(c, null, null); assertNotNull(f2); assertFalse(f2); c = "f".charAt(0); Boolean f3 = converter.toBoolean(c, null, null); assertNotNull(f3); assertFalse(f3); }
@AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String regex = sourceFormat != null && !"".equals(sourceFormat) ? sourceFormat : TRUE_REGEX; if (Character.toString(value).matches(regex)) { return Boolean.TRUE; } return Boolean.FALSE; }
CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String regex = sourceFormat != null && !"".equals(sourceFormat) ? sourceFormat : TRUE_REGEX; if (Character.toString(value).matches(regex)) { return Boolean.TRUE; } return Boolean.FALSE; } }
CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String regex = sourceFormat != null && !"".equals(sourceFormat) ? sourceFormat : TRUE_REGEX; if (Character.toString(value).matches(regex)) { return Boolean.TRUE; } return Boolean.FALSE; }  }
CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String regex = sourceFormat != null && !"".equals(sourceFormat) ? sourceFormat : TRUE_REGEX; if (Character.toString(value).matches(regex)) { return Boolean.TRUE; } return Boolean.FALSE; }  @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.DECIMAL) BigDecimal toBigDecimal(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BIG_INTEGER) BigInteger toBigInteger(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) Boolean toBoolean(Character value, String sourceFormat, String targetFormat); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) Byte toByte(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.CHAR) Character toCharacter(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.DOUBLE) Double toDouble(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.FLOAT) Float toFloat(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.INTEGER) Integer toInteger(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.LONG) Long toLong(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.NUMBER) Number toNumber(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.SHORT, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) Short toShort(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.STRING) String toString(Character value, String sourceFormat, String targetFormat); }
CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String regex = sourceFormat != null && !"".equals(sourceFormat) ? sourceFormat : TRUE_REGEX; if (Character.toString(value).matches(regex)) { return Boolean.TRUE; } return Boolean.FALSE; }  @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.DECIMAL) BigDecimal toBigDecimal(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BIG_INTEGER) BigInteger toBigInteger(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) Boolean toBoolean(Character value, String sourceFormat, String targetFormat); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) Byte toByte(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.CHAR) Character toCharacter(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.DOUBLE) Double toDouble(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.FLOAT) Float toFloat(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.INTEGER) Integer toInteger(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.LONG) Long toLong(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.NUMBER) Number toNumber(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.SHORT, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) Short toShort(Character value); @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.STRING) String toString(Character value, String sourceFormat, String targetFormat);  }