- Type Parameters:
I- the input component typeO- the output component typeR- the serialized type
- All Superinterfaces:
ComponentDecoder<R,O>, ComponentEncoder<I, R>
- All Known Subinterfaces:
ConfigurateComponentSerializer, GsonComponentSerializer, JSONComponentSerializer, LegacyComponentSerializer, MiniMessage, PlainTextComponentSerializer
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 TypeMethodDescriptiondeserialize(R input) Deserialize a component from input of typeR.default @Nullable OdeserializeOr(@Nullable R input, @Nullable O fallback) Deserialize a component from input of typeR.default @Nullable OdeserializeOrNull(@Nullable R input) Deserialize a component from input of typeR.Serializes a component into an output of typeR.default @Nullable RserializeOr(@Nullable I component, @Nullable R fallback) Serializes a component into an output of typeR.default @Nullable RserializeOrNull(@Nullable I component) Serializes a component into an output of typeR.
-
Method Details
-
deserialize
Deserialize a component from input of typeR.- Specified by:
deserializein interfaceComponentDecoder<I extends Component, O extends Component>- Parameters:
input- the input- Returns:
- the component
- Since:
- 4.0.0
-
deserializeOrNull
@Contract(value="!null -> !null; null -> null", pure=true) default @Nullable O deserializeOrNull(@Nullable R input) Deserialize a component from input of typeR.If
inputisnull, thennullwill be returned.- Specified by:
deserializeOrNullin interfaceComponentDecoder<I extends Component, O extends Component>- Parameters:
input- the input- Returns:
- the component if
inputis non-null, otherwisenull - Since:
- 4.8.0
-
deserializeOr
@Contract(value="!null, _ -> !null; null, _ -> param2", pure=true) default @Nullable O deserializeOr(@Nullable R input, @Nullable O fallback) Deserialize a component from input of typeR.If
inputisnull, thenfallbackwill be returned.- Specified by:
deserializeOrin interfaceComponentDecoder<I extends Component, O extends Component>- Parameters:
input- the inputfallback- the fallback value- Returns:
- the component if
inputis non-null, otherwisefallback - Since:
- 4.7.0
-
serialize
-
serializeOrNull
@Contract(value="!null -> !null; null -> null", pure=true) default @Nullable R serializeOrNull(@Nullable I component) Serializes a component into an output of typeR.If
componentisnull, thennullwill be returned.- Specified by:
serializeOrNullin interfaceComponentEncoder<I extends Component, O extends Component>- 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 @Nullable R serializeOr(@Nullable I component, @Nullable R fallback) Serializes a component into an output of typeR.If
componentisnull, thenfallbackwill be returned.- Specified by:
serializeOrin interfaceComponentEncoder<I extends Component, O extends Component>- Parameters:
component- the componentfallback- the fallback value- Returns:
- the output if
componentis non-null, otherwisefallback - Since:
- 4.7.0
-