Repository: camel Updated Branches: refs/heads/master c3b236dbe -> 9863e83d7
CAMEL-9954: Documentation for changes since 2.18.0 Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/87129c85 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/87129c85 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/87129c85 Branch: refs/heads/master Commit: 87129c85ec7258fbb8fc9d95b82f42a2c3bd2895 Parents: c3b236d Author: Arno Noordover <[email protected]> Authored: Sat May 21 17:52:20 2016 +0200 Committer: Arno Noordover <[email protected]> Committed: Sat May 21 17:52:20 2016 +0200 ---------------------------------------------------------------------- components/camel-bindy/src/main/docs/bindy.adoc | 63 +++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/87129c85/components/camel-bindy/src/main/docs/bindy.adoc ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/main/docs/bindy.adoc b/components/camel-bindy/src/main/docs/bindy.adoc index cd6260e..f236c2b 100644 --- a/components/camel-bindy/src/main/docs/bindy.adoc +++ b/components/camel-bindy/src/main/docs/bindy.adoc @@ -66,7 +66,8 @@ the POJO like : * KeyValuePairField (for key = value format like we have in FIX financial messages), * Section (to identify header, body and footer section), -* OneToMany +* OneToMany, +* BindyConverter (since 2.18.0) This section will describe them : @@ -1499,6 +1500,66 @@ public class Security { private String side; --------------------------------------------------------------------------------------------------- +[[Bindy-9.BindyConverter]] +9. BindyConverter +^^^^^^^^^^^^^^^^^ + +The purpose of the annotation @BindyConverter is define a converter +to be used on field level. The provided class must implement the +Format interface. + +[source,java] +--------------------------------------------------------------------------------------------------- +... + @FixedLengthRecord(length = 10, paddingChar = ' ') + public static class DataModel { + @DataField(pos = 1, length = 10, trim = true) + @BindyConverter(CustomConverter.class) + public String field1; + } + + public static class CustomConverter implements Format<String> { + @Override + public String format(String object) throws Exception { + return (new StringBuilder(object)).reverse().toString(); + } + + @Override + public String parse(String string) throws Exception { + return (new StringBuilder(string)).reverse().toString(); + } + } +... +--------------------------------------------------------------------------------------------------- + +[[Bindy-SupportedDatatypes]] +Supported Datatypes +^^^^^^^^^^^^^^^^^^^ + +The DefaultFormatFactory makes formatting of the following datatype available by +returning an instance of the interface FormatFactoryInterface based on the provided +FormattingOptions: + +* BigDecimal +* BigInteger +* Boolean +* Byte +* Character +* Date +* Double +* Enums +* Float +* Integer +* LocalDate (java 8, since 2.18.0) +* LocalDateTime (java 8, since 2.18.0) +* LocalTime (java 8, since 2.18.0) +* Long +* Short +* String + +The DefaultFormatFactory can be overridden by providing an instance of +FactoryRegistry in the registry in use (e.g. spring or JNDI). + [[Bindy-UsingtheJavaDSL]] Using the Java DSL ^^^^^^^^^^^^^^^^^^
