Interface Converter<IN,OUT>

Type Parameters:
IN - Type of values converter takes
OUT - Result type from conversion
All Known Implementing Classes:
Converter.None, StdConverter

public interface Converter<IN,OUT>
Helper interface for things that convert Objects of one type to another.

NOTE: implementors are strongly encouraged to extend StdConverter instead of directly implementing Converter, since that can help with default implementation of typically boiler-plate code.

Since:
2.1
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    This marker class is only to be used with annotations, to indicate that no converter is to be used.
  • Method Summary

    Modifier and Type
    Method
    Description
    default OUT
    Conversion method that also takes in DeserializationContext, useful for some more complex conversions.
    default OUT
    convert(SerializerProvider provider, IN value)
    Conversion method that also takes in SerializerProvider, useful for some more complex conversions.
    convert(IN value)
    Main conversion method.
    Method that can be used to find out actual input (source) type; this usually can be determined from type parameters, but may need to be implemented differently from programmatically defined converters (which cannot change static type parameter bindings).
    Method that can be used to find out actual output (target) type; this usually can be determined from type parameters, but may need to be implemented differently from programmatically defined converters (which cannot change static type parameter bindings).
  • Method Details

    • convert

      OUT convert(IN value)
      Main conversion method.
    • convert

      default OUT convert(DeserializationContext ctxt, IN value)
      Conversion method that also takes in DeserializationContext, useful for some more complex conversions.
      Since:
      2.19
    • convert

      default OUT convert(SerializerProvider provider, IN value)
      Conversion method that also takes in SerializerProvider, useful for some more complex conversions.
      Since:
      2.19
    • getInputType

      JavaType getInputType(TypeFactory typeFactory)
      Method that can be used to find out actual input (source) type; this usually can be determined from type parameters, but may need to be implemented differently from programmatically defined converters (which cannot change static type parameter bindings).
      Since:
      2.2
    • getOutputType

      JavaType getOutputType(TypeFactory typeFactory)
      Method that can be used to find out actual output (target) type; this usually can be determined from type parameters, but may need to be implemented differently from programmatically defined converters (which cannot change static type parameter bindings).
      Since:
      2.2