Class ConvertUtils


  • public final class ConvertUtils
    extends java.lang.Object
    Convert utilities methods.
    Since:
    4.4.1
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.fasterxml.jackson.databind.ObjectMapper getConvertJsonMapper()  
      static com.fasterxml.jackson.databind.ObjectMapper getJsonMapper()  
      static com.fasterxml.jackson.databind.ObjectMapper getYamlMapper()  
      static io.swagger.v3.oas.models.security.SecurityRequirement mapToSecurityRequirement​(io.micronaut.core.annotation.AnnotationValue<io.swagger.v3.oas.annotations.security.SecurityRequirement> r)
      Maps annotation value to SecurityRequirement.
      static java.lang.Object normalizeValue​(java.lang.String valueStr, java.lang.String type)  
      static java.util.Optional<java.util.Map<java.lang.String,​java.lang.Object>> resolveExtensions​(com.fasterxml.jackson.databind.JsonNode jn)  
      static <T> T treeToValue​(com.fasterxml.jackson.databind.JsonNode jn, java.lang.Class<T> clazz)
      Converts Json node into a class' instance or throws 'com.fasterxml.jackson.core.JsonProcessingException', adds extensions if present.
      • Methods inherited from class java.lang.Object

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

      • treeToValue

        public static <T> T treeToValue​(com.fasterxml.jackson.databind.JsonNode jn,
                                        java.lang.Class<T> clazz)
                                 throws com.fasterxml.jackson.core.JsonProcessingException
        Converts Json node into a class' instance or throws 'com.fasterxml.jackson.core.JsonProcessingException', adds extensions if present.
        Type Parameters:
        T - The output class type
        Parameters:
        jn - The json node
        clazz - The output class instance
        Returns:
        The converted instance
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException - if error
      • normalizeValue

        public static java.lang.Object normalizeValue​(java.lang.String valueStr,
                                                      java.lang.String type)
                                               throws com.fasterxml.jackson.core.JsonProcessingException
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • resolveExtensions

        public static java.util.Optional<java.util.Map<java.lang.String,​java.lang.Object>> resolveExtensions​(com.fasterxml.jackson.databind.JsonNode jn)
      • mapToSecurityRequirement

        public static io.swagger.v3.oas.models.security.SecurityRequirement mapToSecurityRequirement​(io.micronaut.core.annotation.AnnotationValue<io.swagger.v3.oas.annotations.security.SecurityRequirement> r)
        Maps annotation value to SecurityRequirement. Correct format is: custom_name: - custom_scope1 - custom_scope2
        Parameters:
        r - The value of SecurityRequirement.
        Returns:
        converted object.
      • getJsonMapper

        public static com.fasterxml.jackson.databind.ObjectMapper getJsonMapper()
      • getConvertJsonMapper

        public static com.fasterxml.jackson.databind.ObjectMapper getConvertJsonMapper()
      • getYamlMapper

        public static com.fasterxml.jackson.databind.ObjectMapper getYamlMapper()