Interface JsonPair

All Superinterfaces:
Comparable<JsonPair>, JsonElement<JsonElement<?>>, de.espirit.firstspirit.json.JsonOutput

@NonExtendable @Experimental public interface JsonPair extends JsonElement<JsonElement<?>>, Comparable<JsonPair>
An interface for representing a json key/value pair containing of a key and a JsonElement. A JsonPair can be part of a JsonObject. CAUTION: This class is still in development and may change drastically without any further notice.
Since:
5.2.191206
See Also:
  • JsonOutput
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull String
    This method returns the current key of the pair.
    @NotNull JsonElement<?>
    This method returns the current value of the pair.
    static @NotNull JsonPair
    of(@NotNull String key, @NotNull JsonElement<?> value)
    Returns a new json pair using the given key and value.

    Methods inherited from interface java.lang.Comparable

    compareTo

    Methods inherited from interface de.espirit.firstspirit.json.JsonOutput

    json, writeTo
  • Method Details

    • of

      @NotNull static @NotNull JsonPair of(@NotNull @NotNull String key, @NotNull @NotNull JsonElement<?> value)
      Returns a new json pair using the given key and value.
      Parameters:
      key - the name that should be used as the key (must not be null)
      value - the element that should be used as the value (must not be null)
      Returns:
      a new json pair
      Since:
      5.2.191206
    • getKey

      @NotNull @NotNull String getKey()
      This method returns the current key of the pair.
      Returns:
      The key of the pair.
      Since:
      5.2.191206
    • getValue

      @NotNull @NotNull JsonElement<?> getValue()
      This method returns the current value of the pair.
      Specified by:
      getValue in interface JsonElement<JsonElement<?>>
      Returns:
      The value of the pair.
      Since:
      5.2.191206