Class DataMapperService


  • @ApplicationScoped
    public class DataMapperService
    extends Object
    Conversions to/from JSON format and to/from CBOR format
    Version:
    May 08, 2020
    Author:
    Yuriy Movchan
    • Constructor Detail

      • DataMapperService

        public DataMapperService()
    • Method Detail

      • init

        @PostConstruct
        public void init()
      • readTree

        public com.fasterxml.jackson.databind.JsonNode readTree​(byte[] content)
                                                         throws IOException
        Throws:
        IOException
      • createObjectNode

        public com.fasterxml.jackson.databind.node.ObjectNode createObjectNode()
      • createArrayNode

        public com.fasterxml.jackson.databind.node.ArrayNode createArrayNode()
      • cborReadTree

        public com.fasterxml.jackson.databind.JsonNode cborReadTree​(byte[] content)
                                                             throws IOException
        Throws:
        IOException
      • cborWriteAsBytes

        public byte[] cborWriteAsBytes​(com.fasterxml.jackson.databind.JsonNode jsonNode)
                                throws IOException
        Throws:
        IOException
      • cborCreateParser

        public com.fasterxml.jackson.dataformat.cbor.CBORParser cborCreateParser​(byte[] data)
                                                                          throws IOException
        Throws:
        IOException
      • convertValue

        public <T> T convertValue​(Object fromValue,
                                  Class<T> toValueType)
      • writeValueAsString

        public String writeValueAsString​(Object value)
                                  throws com.fasterxml.jackson.core.JsonProcessingException
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • readValueString

        public <T> T readValueString​(String content,
                                     Class<T> clazz)
                              throws com.fasterxml.jackson.core.JsonProcessingException
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException