Package space.arim.dazzleconf.serialiser
Class ValueSerialiserMap
java.lang.Object
space.arim.dazzleconf.serialiser.ValueSerialiserMap
An immutable map of value serialisers, keyed by the type which they serialise.
- Author:
- A248
-
Method Summary
Modifier and TypeMethodDescriptionMap<Class<?>, ValueSerialiser<?>> asMap()Gets this value serialiser map as aMap.static ValueSerialiserMapempty()Gets an empty value serialiser mapboolean<T> ValueSerialiser<T> getSerialiser(Class<T> type) Deprecated.<T> Optional<ValueSerialiser<T>> getSerialiserFor(Class<T> type) Gets the value serialiser for a given typeinthashCode()static ValueSerialiserMapof(Collection<? extends ValueSerialiser<?>> serialisers) Creates from a collection of serialisers.static ValueSerialiserMapof(Map<Class<?>, ? extends ValueSerialiser<?>> serialisers) Creates from a map of serialisers.toString()
-
Method Details
-
of
Creates from a collection of serialisers. If any two serialisers specify the same target type (ValueSerialiser.getTargetClass()),IllegalArgumentExceptionis thrown- Parameters:
serialisers- the value serialisers- Returns:
- the value serialiser map
- Throws:
NullPointerException- if any serialiser is nullIllegalArgumentException- if any value serialisers conflict
-
of
Creates from a map of serialisers. If any serialisers are at a mismatched key,IllegalArgumentExceptionis thrown- Parameters:
serialisers- the value serialisers- Returns:
- the value serialiser map
- Throws:
NullPointerException- if any serialiser is nullIllegalArgumentException- if any value serialisers are at a mismatched key
-
empty
Gets an empty value serialiser map- Returns:
- an empty map
-
getSerialiser
Deprecated.UsegetSerialiserFor(Class)insteadGets the value serialiser for a given type- Type Parameters:
T- the type- Parameters:
type- the type class- Returns:
- the value serialiser for the type or
nullif there is none
-
getSerialiserFor
Gets the value serialiser for a given type- Type Parameters:
T- the type- Parameters:
type- the type class- Returns:
- the value serialiser for the type or an empty optional if there is none
-
asMap
Gets this value serialiser map as aMap. This map is immutable.- Returns:
- the map of classes to value serialisers, never
null
-
toString
-
hashCode
public int hashCode() -
equals
-
getSerialiserFor(Class)instead