Interface ComponentDecoder<S,​O extends Component>

  • Type Parameters:
    S - the serialized type
    O - the output component type
    All Known Subinterfaces:
    ComponentSerializer<I,​O,​R>

    public interface ComponentDecoder<S,​O extends Component>
    A Component decoder, which provides deserialization, but without serialization.

    For both serialization and deserialization, use ComponentSerializer

    Since:
    4.16.0
    • Method Detail

      • deserialize

        @NotNull
        O deserialize​(@NotNull
                      S input)
        Deserialize a component from input of type S.
        Parameters:
        input - the input
        Returns:
        the component
        Since:
        4.16.0
      • deserializeOrNull

        @Contract(value="!null -> !null; null -> null",
                  pure=true)
        @Nullable
        default O deserializeOrNull​(@Nullable
                                    S input)
        Deserialize a component from input of type S.

        If input is null, then null will be returned.

        Parameters:
        input - the input
        Returns:
        the component if input is non-null, otherwise null
        Since:
        4.16.0
      • deserializeOr

        @Contract(value="!null, _ -> !null; null, _ -> param2",
                  pure=true)
        @Nullable
        default O deserializeOr​(@Nullable
                                S input,
                                @Nullable
                                O fallback)
        Deserialize a component from input of type S.

        If input is null, then fallback will be returned.

        Parameters:
        input - the input
        fallback - the fallback value
        Returns:
        the component if input is non-null, otherwise fallback
        Since:
        4.16.0