Class Translators


  • public final class Translators
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Translators()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Translator<java.io.InputStream,​byte[]> bytes()
      Fetches the raw byte array from the source and pass it to the service factory as a byte[] array.
      static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> json()
      Expect JSON data format from the source, will provide JsonNode instance to the service factory.
      static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> json​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      See json().
      static <T> Translator<java.io.InputStream,​T> json​(java.lang.Class<T> entityType)
      Expect JSON data format from the source, will provide instance of entityType class to the service factory.
      static <T> Translator<java.io.InputStream,​T> json​(java.lang.Class<T> entityType, com.fasterxml.jackson.databind.ObjectMapper mapper)
      static <T> Translator<java.io.InputStream,​java.util.List<T>> jsonList​(java.lang.Class<T> entityType)
      Same as json(Class), but providing List of entityType class instances.
      static <T> Translator<java.io.InputStream,​java.util.List<T>> jsonList​(java.lang.Class<T> entityType, com.fasterxml.jackson.databind.ObjectMapper mapper)
      static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> jsonParser()
      Expect JSON data format from the source, will provide JsonParser instance to the service factory.
      static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> jsonParser​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      static Translator<java.io.InputStream,​java.lang.String[]> lines()
      Read the source data as string lines (separated by System.lineSeparator) and pass it to the service factory as a String[] array.
      static Translator<java.io.InputStream,​java.lang.String[]> lines​(java.nio.charset.Charset charset)
      Read the source data as string lines (separated by System.lineSeparator()) and pass it to the service factory as a String[] array.
      static Translator<java.io.InputStream,​java.lang.String> string()
      Read the source data as a single string and pass it to the service factory as a String.
      static Translator<java.io.InputStream,​java.lang.String> string​(java.nio.charset.Charset charset)
      Read the source data as a single string and pass it to the service factory as a String.
      static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> xml()
      Expect XML data format from the source, will provide JsonNode instance to the service factory.
      static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> xml​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      See xml().
      static <T> Translator<java.io.InputStream,​T> xml​(java.lang.Class<T> entityType)
      Expect XML data format from the source, will provide instance of entityType class to the service factory.
      static <T> Translator<java.io.InputStream,​T> xml​(java.lang.Class<T> entityType, com.fasterxml.jackson.databind.ObjectMapper mapper)
      static <T> Translator<java.io.InputStream,​java.util.List<T>> xmlList​(java.lang.Class<T> entityType)
      Same as xml(Class), but providing List of entityType class instances.
      static <T> Translator<java.io.InputStream,​java.util.List<T>> xmlList​(java.lang.Class<T> entityType, com.fasterxml.jackson.databind.ObjectMapper mapper)
      static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> xmlParser()
      Expect XML data format from the source, will provide JsonParser instance to the service factory
      static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> xmlParser​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> yaml()
      Expect YAML data format from the source, will provide JsonNode instance to the service factory.
      static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> yaml​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      See yaml().
      static <T> Translator<java.io.InputStream,​T> yaml​(java.lang.Class<T> entityType)
      Expect YAML data format from the source, will provide instance of entityType class to the service factory.
      static <T> Translator<java.io.InputStream,​T> yaml​(java.lang.Class<T> entityType, com.fasterxml.jackson.databind.ObjectMapper mapper)
      static <T> Translator<java.io.InputStream,​java.util.List<T>> yamlList​(java.lang.Class<T> entityType)
      Same as yaml(Class), but providing List of entityType class instances.
      static <T> Translator<java.io.InputStream,​java.util.List<T>> yamlList​(java.lang.Class<T> entityType, com.fasterxml.jackson.databind.ObjectMapper mapper)
      static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> yamlParser()
      Expect YAML data format from the source, will provide JsonParser instance to the service factory.
      static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> yamlParser​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Translators

        public Translators()
    • Method Detail

      • xml

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> xml()
        Expect XML data format from the source, will provide JsonNode instance to the service factory. Please note that by default parser will not wrap root element and duplicate elements will be combined under ArrayNode, so no data is lost.
      • xml

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> xml​(com.fasterxml.jackson.databind.ObjectMapper mapper)
        See xml().
      • xml

        public static <T> Translator<java.io.InputStream,​T> xml​(java.lang.Class<T> entityType)
        Expect XML data format from the source, will provide instance of entityType class to the service factory.
        Parameters:
        entityType - the target type class
      • xml

        public static <T> Translator<java.io.InputStream,​T> xml​(java.lang.Class<T> entityType,
                                                                      com.fasterxml.jackson.databind.ObjectMapper mapper)
      • xmlList

        public static <T> Translator<java.io.InputStream,​java.util.List<T>> xmlList​(java.lang.Class<T> entityType)
        Same as xml(Class), but providing List of entityType class instances.
        Parameters:
        entityType - the target type class
      • xmlList

        public static <T> Translator<java.io.InputStream,​java.util.List<T>> xmlList​(java.lang.Class<T> entityType,
                                                                                          com.fasterxml.jackson.databind.ObjectMapper mapper)
      • xmlParser

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> xmlParser()
        Expect XML data format from the source, will provide JsonParser instance to the service factory
      • xmlParser

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> xmlParser​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      • yaml

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> yaml()
        Expect YAML data format from the source, will provide JsonNode instance to the service factory.
      • yaml

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> yaml​(com.fasterxml.jackson.databind.ObjectMapper mapper)
        See yaml().
      • yaml

        public static <T> Translator<java.io.InputStream,​T> yaml​(java.lang.Class<T> entityType)
        Expect YAML data format from the source, will provide instance of entityType class to the service factory.
        Parameters:
        entityType - the target type class
      • yaml

        public static <T> Translator<java.io.InputStream,​T> yaml​(java.lang.Class<T> entityType,
                                                                       com.fasterxml.jackson.databind.ObjectMapper mapper)
      • yamlList

        public static <T> Translator<java.io.InputStream,​java.util.List<T>> yamlList​(java.lang.Class<T> entityType)
        Same as yaml(Class), but providing List of entityType class instances.
        Parameters:
        entityType - the target type class
      • yamlList

        public static <T> Translator<java.io.InputStream,​java.util.List<T>> yamlList​(java.lang.Class<T> entityType,
                                                                                           com.fasterxml.jackson.databind.ObjectMapper mapper)
      • yamlParser

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> yamlParser()
        Expect YAML data format from the source, will provide JsonParser instance to the service factory.
      • yamlParser

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> yamlParser​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      • json

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> json()
        Expect JSON data format from the source, will provide JsonNode instance to the service factory.
      • json

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.databind.JsonNode> json​(com.fasterxml.jackson.databind.ObjectMapper mapper)
        See json().
      • json

        public static <T> Translator<java.io.InputStream,​T> json​(java.lang.Class<T> entityType)
        Expect JSON data format from the source, will provide instance of entityType class to the service factory.
        Parameters:
        entityType - the target type class
      • json

        public static <T> Translator<java.io.InputStream,​T> json​(java.lang.Class<T> entityType,
                                                                       com.fasterxml.jackson.databind.ObjectMapper mapper)
      • jsonList

        public static <T> Translator<java.io.InputStream,​java.util.List<T>> jsonList​(java.lang.Class<T> entityType)
        Same as json(Class), but providing List of entityType class instances.
        Parameters:
        entityType - the target type class
      • jsonList

        public static <T> Translator<java.io.InputStream,​java.util.List<T>> jsonList​(java.lang.Class<T> entityType,
                                                                                           com.fasterxml.jackson.databind.ObjectMapper mapper)
      • jsonParser

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> jsonParser()
        Expect JSON data format from the source, will provide JsonParser instance to the service factory.
      • jsonParser

        public static Translator<java.io.InputStream,​com.fasterxml.jackson.core.JsonParser> jsonParser​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      • bytes

        public static Translator<java.io.InputStream,​byte[]> bytes()
        Fetches the raw byte array from the source and pass it to the service factory as a byte[] array.
      • string

        public static Translator<java.io.InputStream,​java.lang.String> string()
        Read the source data as a single string and pass it to the service factory as a String.
      • string

        public static Translator<java.io.InputStream,​java.lang.String> string​(java.nio.charset.Charset charset)
        Read the source data as a single string and pass it to the service factory as a String.
        Parameters:
        charset - the charset used to decode data
      • lines

        public static Translator<java.io.InputStream,​java.lang.String[]> lines()
        Read the source data as string lines (separated by System.lineSeparator) and pass it to the service factory as a String[] array.
      • lines

        public static Translator<java.io.InputStream,​java.lang.String[]> lines​(java.nio.charset.Charset charset)
        Read the source data as string lines (separated by System.lineSeparator()) and pass it to the service factory as a String[] array.
        Parameters:
        charset - the charset used to decode data.