Interface MarshallingService

  • All Implemented Interfaces:

    @DoNotImplement() 
    public interface MarshallingService
    
                        

    MarshallingService is an abstract interface for marshalling to and from formatted string data. Corda provides specialized implementations of the marshalling services for converting data in different string formats.

    Example usage:

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract String format(@NotNull() Object data) Format the input data into the service's output format.
      abstract <T> T parse(@NotNull() String input, @NotNull() Class<T> clazz) Parse input strings to strongly typed objects.
      abstract <T> List<T> parseList(@NotNull() String input, @NotNull() Class<T> clazz) Deserializes the input into a list of instances of T.
      abstract <K, V> Map<K, V> parseMap(@NotNull() String input, @NotNull() Class<K> keyClass, @NotNull() Class<V> valueClass) Deserializes the input into a map of instances of V keyed by K
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • format

        @NotNull() abstract String format(@NotNull() Object data)

        Format the input data into the service's output format.

        Parameters:
        data - The object to convert on input.
        Returns:

        String representation of the data formatted according to the provided service.

      • parse

         abstract <T> T parse(@NotNull() String input, @NotNull() Class<T> clazz)

        Parse input strings to strongly typed objects.

        This method will throw an exception if the provided string does not conform to the expected format of the service.

        Parameters:
        input - The input string to parse.
        clazz - The type to try and parse the data into.
        Returns:

        An instance of the required type containing the input data.

      • parseList

        @NotNull() abstract <T> List<T> parseList(@NotNull() String input, @NotNull() Class<T> clazz)

        Deserializes the input into a list of instances of T.

        Parameters:
        input - The input string to parse.
        clazz - The Class type to parse into.
        Returns:

        A new list of T.

      • parseMap

        @NotNull() abstract <K, V> Map<K, V> parseMap(@NotNull() String input, @NotNull() Class<K> keyClass, @NotNull() Class<V> valueClass)

        Deserializes the input into a map of instances of V keyed by K

        Parameters:
        input - The input string to parse.
        keyClass - The key Class type to parse into.
        valueClass - The value Class type to parse into.
        Returns:

        A new map of V, keyed by K.