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>
A
Component encoder, which provides serialization, but without deserialization.
For both serialization and deserialization, use ComponentSerializer
- Since:
- 4.14.0
-
Method Summary
Modifier and TypeMethodDescriptionSerializes a component into an output of typeR.default RserializeOr(I component, R fallback) Serializes a component into an output of typeR.default RserializeOrNull(I component) Serializes a component into an output of typeR.
-
Method Details
-
serialize
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
componentisnull, thennullwill be returned.- Parameters:
component- the component- Returns:
- the output if
componentis 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
componentisnull, thenfallbackwill be returned.- Parameters:
component- the componentfallback- the fallback value- Returns:
- the output if
componentis non-null, otherwisefallback - Since:
- 4.14.0
-