- Type Parameters:
I- the input component typeO- the output component typeR- the serialized type
public interface ComponentSerializer<I extends Component,O extends Component,R>
A
Component serializer and deserializer.- Since:
- 4.0.0
-
Method Summary
Modifier and Type Method Description default @PolyNull OdeseializeOrNull(@PolyNull R input)Deserialize a component from input of typeR.@NonNull Odeserialize(@NonNull R input)Deserialize a component from input of typeR.default @PolyNull OdeserializeOr(@Nullable R input, @PolyNull O fallback)Deserialize a component from input of typeR.@NonNull Rserialize(@NonNull I component)Serializes a component into an output of typeR.default @PolyNull RserializeOr(@Nullable I component, @PolyNull R fallback)Serializes a component into an output of typeR.default @PolyNull RserializeOrNull(@PolyNull I component)Serializes a component into an output of typeR.
-
Method Details
-
deserialize
Deserialize a component from input of typeR.- Parameters:
input- the input- Returns:
- the component
- Since:
- 4.0.0
-
deseializeOrNull
@Contract(value="!null -> !null; null -> null", pure=true) default @PolyNull O deseializeOrNull(@PolyNull R input)Deserialize a component from input of typeR.If
inputisnull, thennullwill be returned.- Parameters:
input- the input- Returns:
- the component if
inputis non-null, otherwisenull - Since:
- 4.7.0
-
deserializeOr
@Contract(value="!null, _ -> !null; null, _ -> param2", pure=true) default @PolyNull O deserializeOr(@Nullable R input, @PolyNull O fallback)Deserialize a component from input of typeR.If
inputisnull, thenfallbackwill be returned.- Parameters:
input- the inputfallback- the fallback value- Returns:
- the component if
inputis non-null, otherwisefallback - Since:
- 4.7.0
-
serialize
Serializes a component into an output of typeR.- Parameters:
component- the component- Returns:
- the output
- Since:
- 4.0.0
-
serializeOrNull
@Contract(value="!null -> !null; null -> null", pure=true) default @PolyNull R serializeOrNull(@PolyNull I component)Serializes a component into an output of typeR.If
componentisnull, thennullwill be returned.- Parameters:
component- the component- Returns:
- the output if
componentis non-null, otherwisenull - Since:
- 4.7.0
-
serializeOr
@Contract(value="!null, _ -> !null; null, _ -> param2", pure=true) default @PolyNull R serializeOr(@Nullable I component, @PolyNull R fallback)Serializes a component into an output of typeR.If
componentisnull, thenfallbackwill be returned.- Parameters:
component- the componentfallback- the fallback value- Returns:
- the output if
componentis non-null, otherwisefallback - Since:
- 4.7.0
-