Interface ComponentEncoder<I extends Component,R>
-
- Type Parameters:
I
- the input component typeR
- the serialized type
- All Known Subinterfaces:
ComponentSerializer<I,O,R>
public interface ComponentEncoder<I extends Component,R>
AComponent
encoder, which provides serialization, but without deserialization.For both serialization and deserialization, use
ComponentSerializer
- Since:
- 4.14.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description R
serialize(I component)
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 Detail
-
serialize
@NotNull R serialize(@NotNull I component)
Serializes a component into an output of typeR
.- Parameters:
component
- the component- Returns:
- the output
- Since:
- 4.14.0
-
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.- Parameters:
component
- the component- Returns:
- the output if
component
is non-null, otherwisenull
- Since:
- 4.14.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.- Parameters:
component
- the componentfallback
- the fallback value- Returns:
- the output if
component
is non-null, otherwisefallback
- Since:
- 4.14.0
-
-