Class MarshallerImpl

java.lang.Object
blue.endless.jankson.impl.MarshallerImpl
All Implemented Interfaces:
Marshaller

@Deprecated public class MarshallerImpl extends Object implements Marshaller
Deprecated.
For removal; please use Marshaller
  • Constructor Details

    • MarshallerImpl

      public MarshallerImpl()
      Deprecated.
  • Method Details

    • getFallback

      public static Marshaller getFallback()
      Deprecated.
    • register

      public <T> void register(Class<T> clazz, Function<Object,T> marshaller)
      Deprecated.
    • registerTypeAdapter

      public <T> void registerTypeAdapter(Class<T> clazz, Function<JsonObject,T> adapter)
      Deprecated.
    • registerSerializer

      public <T> void registerSerializer(Class<T> clazz, Function<T,JsonElement> serializer)
      Deprecated.
    • registerSerializer

      public <T> void registerSerializer(Class<T> clazz, BiFunction<T,Marshaller,JsonElement> serializer)
      Deprecated.
    • registerTypeFactory

      public <T> void registerTypeFactory(Class<T> clazz, Supplier<T> supplier)
      Deprecated.
    • registerDeserializer

      public <A, B> void registerDeserializer(Class<A> sourceClass, Class<B> targetClass, DeserializerFunction<A,B> function)
      Deprecated.
    • marshall

      @Nullable public <T> T marshall(Type type, JsonElement elem)
      Deprecated.
      EXPERIMENTAL. Marshalls elem into a very specific parameterized type, honoring generic type arguments.
      Specified by:
      marshall in interface Marshaller
      Type Parameters:
      T - The type to force-cast to at the end
      Parameters:
      type - The type to deserialize to
      elem - json intermediate representation of the data to be unpacked.
      Returns:
      A new object of the provided Type that represents the data in the json provided.
    • marshall

      public <T> T marshall(Class<T> clazz, JsonElement elem)
      Deprecated.
      Description copied from interface: Marshaller
      Unpacks the provided JsonElement into a new object of type clazz, making a best effort to unpack all the fields it can. Any fields that cannot be unpacked will be left in the state the initializer and no-arg constructor leaves them in.

      Note: Consider using Marshaller.marshallCarefully(Class, JsonElement) to detect errors first, and then calling this method as a fallback if an error is encountered.

      Specified by:
      marshall in interface Marshaller
      Type Parameters:
      T - The type of the object to create and deserialize
      Parameters:
      clazz - The class of the object to create and deserialize
      elem - json intermediate representation of the data to be unpacked.
      Returns:
      A new object of the provided class that represents the data in the json provided.
    • marshallCarefully

      public <T> T marshallCarefully(Class<T> clazz, JsonElement elem) throws DeserializationException
      Deprecated.
      Description copied from interface: Marshaller
      Unpacks the provided JsonElement in fail-fast mode. A detailed exception is thrown for any problem encountered during the unpacking process.
      Specified by:
      marshallCarefully in interface Marshaller
      Type Parameters:
      T - The type of the object to create and deserialize
      Parameters:
      clazz - The class of the object to create and deserialize
      elem - json intermediate representation of the data to be unpacked.
      Returns:
      A new object of the provided class that represents the data in the json provided.
      Throws:
      DeserializationException - if any problems are encountered unpacking the data.
    • marshall

      @Nullable public <T> T marshall(Class<T> clazz, JsonElement elem, boolean failFast) throws DeserializationException
      Deprecated.
      Throws:
      DeserializationException
    • serialize

      public JsonElement serialize(Object obj)
      Deprecated.
      Description copied from interface: Marshaller
      Turns a java object into its json intermediate representation.
      Specified by:
      serialize in interface Marshaller