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:
-
-
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 ofT
.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 ofV
keyed byK
-
-
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 ofT
.- Parameters:
input
- The input string to parse.clazz
- The Class type to parse into.- Returns:
A new list of
T
.
-
-
-
-