- 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 O
deseializeOrNull(@PolyNull R input)
Deserialize a component from input of typeR
.@NonNull O
deserialize(@NonNull R input)
Deserialize a component from input of typeR
.default @PolyNull O
deserializeOr(@Nullable R input, @PolyNull O fallback)
Deserialize a component from input of typeR
.@NonNull R
serialize(@NonNull I component)
Serializes a component into an output of typeR
.default @PolyNull R
serializeOr(@Nullable I component, @PolyNull R fallback)
Serializes a component into an output of typeR
.default @PolyNull R
serializeOrNull(@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
input
isnull
, thennull
will be returned.- Parameters:
input
- the input- Returns:
- the component if
input
is 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
input
isnull
, thenfallback
will be returned.- Parameters:
input
- the inputfallback
- the fallback value- Returns:
- the component if
input
is 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
component
isnull
, thennull
will be returned.- Parameters:
component
- the component- Returns:
- the output if
component
is 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
component
isnull
, thenfallback
will be returned.- Parameters:
component
- the componentfallback
- the fallback value- Returns:
- the output if
component
is non-null, otherwisefallback
- Since:
- 4.7.0
-