- Type Parameters:
I
- the input component typeO
- the output component typeR
- the serialized type
- All Superinterfaces:
ComponentDecoder<R,
,O> ComponentEncoder<I,
R>
public interface ComponentSerializer<I extends Component,O extends Component,R>
extends ComponentEncoder<I,R>, ComponentDecoder<R,O>
A
Component
serializer and deserializer.- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault O
deseializeOrNull
(R input) Deprecated.deserialize
(R input) Deserialize a component from input of typeR
.default O
deserializeOr
(R input, O fallback) Deserialize a component from input of typeR
.default O
deserializeOrNull
(R input) Deserialize a component from input of typeR
.Serializes a component into an output of typeR
.default R
serializeOr
(I component, R fallback) Serializes a component into an output of typeR
.default R
serializeOrNull
(I component) Serializes a component into an output of typeR
.
-
Method Details
-
deserialize
Deserialize a component from input of typeR
.- Specified by:
deserialize
in interfaceComponentDecoder<I extends Component,
O extends Component> - Parameters:
input
- the input- Returns:
- the component
- Since:
- 4.0.0
-
deseializeOrNull
@ScheduledForRemoval(inVersion="5.0.0") @Contract(value="!null -> !null; null -> null", pure=true) @Deprecated @Nullable default O deseializeOrNull(@Nullable R input) Deprecated.for removal since 4.8.0, usedeserializeOrNull(Object)
instead.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
-
deserializeOrNull
@Contract(value="!null -> !null; null -> null", pure=true) @Nullable default O deserializeOrNull(@Nullable R input) Deserialize a component from input of typeR
.If
input
isnull
, thennull
will be returned.- Specified by:
deserializeOrNull
in interfaceComponentDecoder<I extends Component,
O extends Component> - Parameters:
input
- the input- Returns:
- the component if
input
is non-null, otherwisenull
- Since:
- 4.8.0
-
deserializeOr
@Contract(value="!null, _ -> !null; null, _ -> param2", pure=true) @Nullable default O deserializeOr(@Nullable R input, @Nullable O fallback) Deserialize a component from input of typeR
.If
input
isnull
, thenfallback
will be returned.- Specified by:
deserializeOr
in interfaceComponentDecoder<I extends Component,
O extends Component> - 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
. -
serializeOrNull
@Contract(value="!null -> !null; null -> null", pure=true) @Nullable default R serializeOrNull(@Nullable I component) Serializes a component into an output of typeR
.If
component
isnull
, thennull
will be returned.- Specified by:
serializeOrNull
in interfaceComponentEncoder<I extends Component,
O extends Component> - 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) @Nullable default R serializeOr(@Nullable I component, @Nullable R fallback) Serializes a component into an output of typeR
.If
component
isnull
, thenfallback
will be returned.- Specified by:
serializeOr
in interfaceComponentEncoder<I extends Component,
O extends Component> - Parameters:
component
- the componentfallback
- the fallback value- Returns:
- the output if
component
is non-null, otherwisefallback
- Since:
- 4.7.0
-
deserializeOrNull(Object)
instead.