Interface GsonComponentSerializer

    • Method Detail

      • gson

        @NotNull
        static @NotNull GsonComponentSerializer gson()
        Gets a component serializer for gson serialization and deserialization.
        Returns:
        a gson component serializer
        Since:
        4.0.0
      • colorDownsamplingGson

        @NotNull
        static @NotNull GsonComponentSerializer colorDownsamplingGson()
        Gets a component serializer for gson serialization and deserialization.

        Hex colors are coerced to the nearest named color, and legacy hover events are emitted for action HoverEvent.Action.SHOW_TEXT.

        Returns:
        a gson component serializer
        Since:
        4.0.0
      • serializer

        @NotNull
        @NotNull com.google.gson.Gson serializer()
        Gets the underlying gson serializer.
        Returns:
        a gson serializer
        Since:
        4.0.0
      • populator

        @NotNull
        @NotNull java.util.function.UnaryOperator<com.google.gson.GsonBuilder> populator()
        Gets the underlying gson populator.
        Returns:
        a gson populator
        Since:
        4.0.0
      • deserializeFromTree

        @NotNull
        @NotNull Component deserializeFromTree​(@NotNull
                                               @NotNull com.google.gson.JsonElement input)
        Deserialize a component from input of type JsonElement.
        Parameters:
        input - the input
        Returns:
        the component
        Since:
        4.7.0
      • serializeToTree

        @NotNull
        @NotNull com.google.gson.JsonElement serializeToTree​(@NotNull
                                                             @NotNull Component component)
        Deserialize a component to output of type JsonElement.
        Parameters:
        component - the component
        Returns:
        the json element
        Since:
        4.7.0