Contents
Class SchemaContext
java.lang.Object
com.hypixel.hytale.codec.schema.SchemaContext
A context used to assist building schema from codecs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFileReference(String fileName, SchemaConvertable<?> codec) Adds a file reference to the context.getFileReference(SchemaConvertable<?> codec) Returns a schema referencing the codec or null if this codec isn't stored in its own file.getRawDefinition(BuilderCodec<?> codec) Gets the raw schema definition for the passed codec.getRawDefinition(RecordCodec<?> codec) getRawDefinition(NamedSchema namedSchema) Gets the raw schema definition for the passed named schema.refDefinition(SchemaConvertable<?> codec) Returns a reference to the passed codec if it's a builder codec, creating the schema if needed.<T> SchemarefDefinition(SchemaConvertable<T> convertable, T def) Returns a reference to the passed codec if it's a builder codec, creating the schema if needed.
-
Constructor Details
-
SchemaContext
public SchemaContext()Default Constructor for aSchemaContextinstance.
-
-
Method Details
-
addFileReference
Adds a file reference to the context.A file reference is a codec that is stored in a external file and should be accessed by a reference.
- Parameters:
fileName- The filename to access this by.codec- The codec.
-
getFileReference
Returns a schema referencing the codec or null if this codec isn't stored in its own file.- Parameters:
codec- The codec to get.- Returns:
- The schema ref or null.
-
refDefinition
Returns a reference to the passed codec if it's a builder codec, creating the schema if needed. Otherwise, just returns the schema for the codec.- Parameters:
codec- The codec to ref.- Returns:
- The schema or schema ref.
-
refDefinition
@Nonnull public <T> Schema refDefinition(@Nonnull SchemaConvertable<T> convertable, @Nullable T def) Returns a reference to the passed codec if it's a builder codec, creating the schema if needed. Otherwise, just returns the schema for the codec.- Type Parameters:
T- The type of the codec.- Parameters:
convertable- The codec to ref.def- The default value.- Returns:
- The schema or schema ref.
-
getRawDefinition
Gets the raw schema definition for the passed codec.- Parameters:
codec- The codec.- Returns:
- the raw schema, or
nullif the codec is not aBuilderCodec.
-
getRawDefinition
-
getRawDefinition
Gets the raw schema definition for the passed named schema.- Parameters:
namedSchema- The named schema.- Returns:
- the raw schema definition, or
nullif the named schema is not registered.
-
getDefinitions
-
getOtherDefinitions
-