Record Class Schema

java.lang.Object
java.lang.Record
net.minecraft.server.jsonrpc.api.Schema

public record Schema(Optional<URI> reference, Optional<String> type, Optional<Schema> items, Optional<Map<String,Schema>> properties, Optional<List<String>> enumValues) extends Record
  • Field Details

    • reference

      private final Optional<URI> reference
      The field for the reference record component.
    • type

      private final Optional<String> type
      The field for the type record component.
    • items

      private final Optional<Schema> items
      The field for the items record component.
    • properties

      private final Optional<Map<String,Schema>> properties
      The field for the properties record component.
    • enumValues

      private final Optional<List<String>> enumValues
      The field for the enumValues record component.
    • CODEC

      public static final com.mojang.serialization.Codec<Schema> CODEC
    • SCHEMA_REGISTRY

      private static final List<SchemaComponent> SCHEMA_REGISTRY
    • BOOL_SCHEMA

      public static final Schema BOOL_SCHEMA
    • INT_SCHEMA

      public static final Schema INT_SCHEMA
    • NUMBER_SCHEMA

      public static final Schema NUMBER_SCHEMA
    • STRING_SCHEMA

      public static final Schema STRING_SCHEMA
    • UUID_SCHEMA

      public static final Schema UUID_SCHEMA
    • DIFFICULTY_SCHEMA

      public static final SchemaComponent DIFFICULTY_SCHEMA
    • GAME_TYPE_SCHEMA

      public static final SchemaComponent GAME_TYPE_SCHEMA
    • PLAYER_SCHEMA

      public static final SchemaComponent PLAYER_SCHEMA
    • VERSION_SCHEMA

      public static final SchemaComponent VERSION_SCHEMA
    • SERVER_STATE_SCHEMA

      public static final SchemaComponent SERVER_STATE_SCHEMA
    • RULE_TYPE_SCHEMA

      public static final Schema RULE_TYPE_SCHEMA
    • TYPED_GAME_RULE_SCHEMA

      public static final SchemaComponent TYPED_GAME_RULE_SCHEMA
    • UNTYPED_GAME_RULE_SCHEMA

      public static final SchemaComponent UNTYPED_GAME_RULE_SCHEMA
    • MESSAGE_SCHEMA

      public static final SchemaComponent MESSAGE_SCHEMA
    • SYSTEM_MESSAGE_SCHEMA

      public static final SchemaComponent SYSTEM_MESSAGE_SCHEMA
    • KICK_PLAYER_SCHEMA

      public static final SchemaComponent KICK_PLAYER_SCHEMA
    • OPERATOR_SCHEMA

      public static final SchemaComponent OPERATOR_SCHEMA
    • INCOMING_IP_BAN_SCHEMA

      public static final SchemaComponent INCOMING_IP_BAN_SCHEMA
    • IP_BAN_SCHEMA

      public static final SchemaComponent IP_BAN_SCHEMA
    • PLAYER_BAN_SCHEMA

      public static final SchemaComponent PLAYER_BAN_SCHEMA
  • Constructor Details

    • Schema

      public Schema(Optional<URI> reference, Optional<String> type, Optional<Schema> items, Optional<Map<String,Schema>> properties, Optional<List<String>> enumValues)
      Creates an instance of a Schema record class.
      Parameters:
      reference - the value for the reference record component
      type - the value for the type record component
      items - the value for the items record component
      properties - the value for the properties record component
      enumValues - the value for the enumValues record component
  • Method Details

    • registerSchema

      private static SchemaComponent registerSchema(String pName, Schema pSchema)
    • getSchemaRegistry

      public static List<SchemaComponent> getSchemaRegistry()
    • ofRef

      public static Schema ofRef(URI pReference)
    • ofType

      public static Schema ofType(String pType)
    • ofEnum

      public static <E extends Enum<E> & StringRepresentable> Schema ofEnum(Supplier<E[]> pEnumValues)
    • ofEnum

      public static Schema ofEnum(List<String> pValues)
    • arrayOf

      public static Schema arrayOf(Schema pSchema)
    • record

      public static Schema record()
    • record

      public static Schema record(Map<String,Schema> pFields)
    • withField

      public Schema withField(String pName, Schema pSchema)
    • asArray

      public Schema asArray()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • reference

      public Optional<URI> reference()
      Returns the value of the reference record component.
      Returns:
      the value of the reference record component
    • type

      public Optional<String> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • items

      public Optional<Schema> items()
      Returns the value of the items record component.
      Returns:
      the value of the items record component
    • properties

      public Optional<Map<String,Schema>> properties()
      Returns the value of the properties record component.
      Returns:
      the value of the properties record component
    • enumValues

      public Optional<List<String>> enumValues()
      Returns the value of the enumValues record component.
      Returns:
      the value of the enumValues record component