Record Class Schema<T>

java.lang.Object
java.lang.Record
net.minecraft.server.jsonrpc.api.Schema<T>

public record Schema<T>(Optional<URI> reference, List<String> type, Optional<Schema<?>> items, Map<String,Schema<?>> properties, List<String> enumValues, com.mojang.serialization.Codec<T> codec) extends Record
  • Field Details

  • Constructor Details

    • Schema

      public Schema(Optional<URI> reference, List<String> type, Optional<Schema<?>> items, Map<String,Schema<?>> properties, List<String> enumValues, com.mojang.serialization.Codec<T> codec)
      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
      codec - the value for the codec record component
  • Method Details

    • typedCodec

      public static <T> com.mojang.serialization.Codec<Schema<T>> typedCodec()
    • info

      public Schema<T> info()
    • registerSchema

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

      public static List<SchemaComponent<?>> getSchemaRegistry()
    • ofRef

      public static <T> Schema<T> ofRef(URI pReference, com.mojang.serialization.Codec<T> pCodec)
    • ofType

      public static <T> Schema<T> ofType(String pType, com.mojang.serialization.Codec<T> pCodec)
    • ofTypes

      public static <T> Schema<T> ofTypes(List<String> pTypes, com.mojang.serialization.Codec<T> pCodec)
    • ofEnum

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

      public static <E extends Enum<E> & StringRepresentable> Schema<E> ofEnum(Supplier<E[]> pEnumValues, com.mojang.serialization.Codec<E> pCodec)
    • ofEnum

      public static <T> Schema<T> ofEnum(List<String> pEnumValues, com.mojang.serialization.Codec<T> pCodec)
    • arrayOf

      public static <T> Schema<List<T>> arrayOf(Schema<?> pSchema, com.mojang.serialization.Codec<T> pCodec)
    • record

      public static <T> Schema<T> record(com.mojang.serialization.Codec<T> pCodec)
    • record

      private static <T> Schema<T> record(Map<String,Schema<?>> pProperties, com.mojang.serialization.Codec<T> pCodec)
    • withField

      public Schema<T> withField(String pName, Schema<?> pSchema)
    • asArray

      public Schema<List<T>> 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 List<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 Map<String,Schema<?>> properties()
      Returns the value of the properties record component.
      Returns:
      the value of the properties record component
    • enumValues

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

      public com.mojang.serialization.Codec<T> codec()
      Returns the value of the codec record component.
      Returns:
      the value of the codec record component