Skip to contentPackage: ValueDeserializers
ValueDeserializers
Coverage
1: package cz.cvut.kbss.jsonld.deserialization;
2:
3: import cz.cvut.kbss.jsonld.common.Configurable;
4:
5: import java.util.Optional;
6:
7: /**
8: * Manages custom deserializers.
9: */
10: public interface ValueDeserializers extends Configurable {
11:
12: /**
13: * Checks whether a custom deserializer is registered for the specified type.
14: *
15: * @param type Type to check for custom deserializer for
16: * @param <T> Type of value
17: * @return Whether a custom deserializer exists
18: */
19: <T> boolean hasCustomDeserializer(Class<T> type);
20:
21: /**
22: * Gets a custom deserializer for the specified deserialization context.
23: *
24: * @param ctx Context representing the deserialization
25: * @param <T> Type of the value
26: * @return Optional containing the custom deserializer registered for the specified type or an empty optional if there is none
27: */
28: <T> Optional<ValueDeserializer<T>> getDeserializer(DeserializationContext<T> ctx);
29:
30: /**
31: * Registers the specified deserializer for the specified type.
32: *
33: * @param forType Type to be deserialized using the specified deserializer
34: * @param deserializer Deserializer to register
35: * @param <T> Value type
36: */
37: <T> void registerDeserializer(Class<T> forType, ValueDeserializer<T> deserializer);
38: }