Package com.io7m.smfj.validation.api

## Class SMFSchema

- java.lang.Object
- - com.io7m.smfj.validation.api.SMFSchema

- All Implemented Interfaces:
    `SMFSchemaType`

      public final class SMFSchema
      extends java.lang.Object
      implements SMFSchemaType

  The type of schemas.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `SMFSchema.Builder` | Builds instances of type `SMFSchema`.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SMFSchemaAllowExtraAttributes` | `allowExtraAttributes()` |
    `static SMFSchema.Builder` | `builder()` | Creates a builder for `SMFSchema`.
    `static SMFSchema` | `copyOf​(SMFSchemaType instance)` | Creates an immutable copy of a `SMFSchemaType` value.
    `boolean` | `equals​(java.lang.Object another)` | This instance is equal to all instances of `SMFSchema` that have equal attribute values.
    `int` | `hashCode()` | Computes a hash code from attributes: `schemaIdentifier`, `requiredAttributes`, `optionalAttributes`, `requiredCoordinateSystem`, `allowExtraAttributes`, `requireTriangles`, `requireVertices`.
    `static SMFSchema` | `of​(SMFSchemaIdentifier schemaIdentifier, java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> requiredAttributes, java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> optionalAttributes, java.util.Optional<? extends SMFCoordinateSystem> requiredCoordinateSystem, SMFSchemaAllowExtraAttributes allowExtraAttributes, SMFSchemaRequireTriangles requireTriangles, SMFSchemaRequireVertices requireVertices)` | Construct a new immutable `SMFSchema` instance.
    `java.util.Map<SMFAttributeName,​SMFSchemaAttribute>` | `optionalAttributes()` | A schema may define optional attributes.
    `java.util.Map<SMFAttributeName,​SMFSchemaAttribute>` | `requiredAttributes()` | A schema may define required attributes.
    `java.util.Optional<SMFCoordinateSystem>` | `requiredCoordinateSystem()` |
    `SMFSchemaRequireTriangles` | `requireTriangles()` |
    `SMFSchemaRequireVertices` | `requireVertices()` |
    `SMFSchemaIdentifier` | `schemaIdentifier()` |
    `java.lang.String` | `toString()` | Prints the immutable value `SMFSchema` with attribute values.
    `SMFSchema` | `withAllowExtraAttributes​(SMFSchemaAllowExtraAttributes value)` | Copy the current immutable object by setting a value for the `allowExtraAttributes` attribute.
    `SMFSchema` | `withOptionalAttributes​(java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> entries)` | Copy the current immutable object by replacing the `optionalAttributes` map with the specified map.
    `SMFSchema` | `withRequiredAttributes​(java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> entries)` | Copy the current immutable object by replacing the `requiredAttributes` map with the specified map.
    `SMFSchema` | `withRequiredCoordinateSystem​(SMFCoordinateSystem value)` | Copy the current immutable object by setting a present value for the optional `requiredCoordinateSystem` attribute.
    `SMFSchema` | `withRequiredCoordinateSystem​(java.util.Optional<? extends SMFCoordinateSystem> optional)` | Copy the current immutable object by setting an optional value for the `requiredCoordinateSystem` attribute.
    `SMFSchema` | `withRequireTriangles​(SMFSchemaRequireTriangles value)` | Copy the current immutable object by setting a value for the `requireTriangles` attribute.
    `SMFSchema` | `withRequireVertices​(SMFSchemaRequireVertices value)` | Copy the current immutable object by setting a value for the `requireVertices` attribute.
    `SMFSchema` | `withSchemaIdentifier​(SMFSchemaIdentifier value)` | Copy the current immutable object by setting a value for the `schemaIdentifier` attribute.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.io7m.smfj.validation.api.SMFSchemaType

      `checkPreconditions`

- - ### Method Detail

    - #### schemaIdentifier

          public SMFSchemaIdentifier schemaIdentifier()

      Specified by:
        `schemaIdentifier` in interface `SMFSchemaType`
      Returns:
        The unique schema identifier

    - #### requiredAttributes

          public java.util.Map<SMFAttributeName,​SMFSchemaAttribute> requiredAttributes()

      A schema may define required attributes. An attribute is not allowed to be both required and optional at the same time.
      Specified by:
        `requiredAttributes` in interface `SMFSchemaType`
      Returns:
        The required attributes

    - #### optionalAttributes

          public java.util.Map<SMFAttributeName,​SMFSchemaAttribute> optionalAttributes()

      A schema may define optional attributes. An attribute is not allowed to be both required and optional at the same time.
      Specified by:
        `optionalAttributes` in interface `SMFSchemaType`
      Returns:
        The optional attributes

    - #### requiredCoordinateSystem

          public java.util.Optional<SMFCoordinateSystem> requiredCoordinateSystem()

      Specified by:
        `requiredCoordinateSystem` in interface `SMFSchemaType`
      Returns:
        The required coordinate system, if any

    - #### allowExtraAttributes

          public SMFSchemaAllowExtraAttributes allowExtraAttributes()

      Specified by:
        `allowExtraAttributes` in interface `SMFSchemaType`
      Returns:
        `SMFSchemaAllowExtraAttributes.SMF_EXTRA_ATTRIBUTES_ALLOWED` if the mesh is allowed to contain attributes that are not given in `requiredAttributes()`

    - #### requireTriangles

          public SMFSchemaRequireTriangles requireTriangles()

      Specified by:
        `requireTriangles` in interface `SMFSchemaType`
      Returns:
        `SMFSchemaRequireTriangles.SMF_TRIANGLES_REQUIRED` if a non-zero triangle count is required

    - #### requireVertices

          public SMFSchemaRequireVertices requireVertices()

      Specified by:
        `requireVertices` in interface `SMFSchemaType`
      Returns:
        `SMFSchemaRequireVertices.SMF_VERTICES_REQUIRED` if a non-zero vertex count is required

    - #### withSchemaIdentifier

          public final SMFSchema withSchemaIdentifier​(SMFSchemaIdentifier value)

      Copy the current immutable object by setting a value for the `schemaIdentifier` attribute. A shallow reference equality check is used to prevent copying of the same value by returning `this`.
      Parameters:
        `value` - A new value for schemaIdentifier
      Returns:
        A modified copy of the `this` object

    - #### withRequiredAttributes

          public final SMFSchema withRequiredAttributes​(java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> entries)

      Copy the current immutable object by replacing the `requiredAttributes` map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning `this`.
      Parameters:
        `entries` - The entries to be added to the requiredAttributes map
      Returns:
        A modified copy of `this` object

    - #### withOptionalAttributes

          public final SMFSchema withOptionalAttributes​(java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> entries)

      Copy the current immutable object by replacing the `optionalAttributes` map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning `this`.
      Parameters:
        `entries` - The entries to be added to the optionalAttributes map
      Returns:
        A modified copy of `this` object

    - #### withRequiredCoordinateSystem

          public final SMFSchema withRequiredCoordinateSystem​(SMFCoordinateSystem value)

      Copy the current immutable object by setting a present value for the optional `requiredCoordinateSystem` attribute.
      Parameters:
        `value` - The value for requiredCoordinateSystem
      Returns:
        A modified copy of `this` object

    - #### withRequiredCoordinateSystem

          public final SMFSchema withRequiredCoordinateSystem​(java.util.Optional<? extends SMFCoordinateSystem> optional)

      Copy the current immutable object by setting an optional value for the `requiredCoordinateSystem` attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning `this`.
      Parameters:
        `optional` - A value for requiredCoordinateSystem
      Returns:
        A modified copy of `this` object

    - #### withAllowExtraAttributes

          public final SMFSchema withAllowExtraAttributes​(SMFSchemaAllowExtraAttributes value)

      Copy the current immutable object by setting a value for the `allowExtraAttributes` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
      Parameters:
        `value` - A new value for allowExtraAttributes
      Returns:
        A modified copy of the `this` object

    - #### withRequireTriangles

          public final SMFSchema withRequireTriangles​(SMFSchemaRequireTriangles value)

      Copy the current immutable object by setting a value for the `requireTriangles` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
      Parameters:
        `value` - A new value for requireTriangles
      Returns:
        A modified copy of the `this` object

    - #### withRequireVertices

          public final SMFSchema withRequireVertices​(SMFSchemaRequireVertices value)

      Copy the current immutable object by setting a value for the `requireVertices` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
      Parameters:
        `value` - A new value for requireVertices
      Returns:
        A modified copy of the `this` object

    - #### equals

          public boolean equals​(java.lang.Object another)

      This instance is equal to all instances of `SMFSchema` that have equal attribute values.
      Overrides:
        `equals` in class `java.lang.Object`
      Returns:
        `true` if `this` is equal to `another` instance

    - #### hashCode

          public int hashCode()

      Computes a hash code from attributes: `schemaIdentifier`, `requiredAttributes`, `optionalAttributes`, `requiredCoordinateSystem`, `allowExtraAttributes`, `requireTriangles`, `requireVertices`.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        hashCode value

    - #### toString

          public java.lang.String toString()

      Prints the immutable value `SMFSchema` with attribute values.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A string representation of the value

    - #### of

          public static SMFSchema of​(SMFSchemaIdentifier schemaIdentifier,
                                     java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> requiredAttributes,
                                     java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> optionalAttributes,
                                     java.util.Optional<? extends SMFCoordinateSystem> requiredCoordinateSystem,
                                     SMFSchemaAllowExtraAttributes allowExtraAttributes,
                                     SMFSchemaRequireTriangles requireTriangles,
                                     SMFSchemaRequireVertices requireVertices)

      Construct a new immutable `SMFSchema` instance.
      Parameters:
        `schemaIdentifier` - The value for the `schemaIdentifier` attribute
        `requiredAttributes` - The value for the `requiredAttributes` attribute
        `optionalAttributes` - The value for the `optionalAttributes` attribute
        `requiredCoordinateSystem` - The value for the `requiredCoordinateSystem` attribute
        `allowExtraAttributes` - The value for the `allowExtraAttributes` attribute
        `requireTriangles` - The value for the `requireTriangles` attribute
        `requireVertices` - The value for the `requireVertices` attribute
      Returns:
        An immutable SMFSchema instance

    - #### copyOf

          public static SMFSchema copyOf​(SMFSchemaType instance)

      Creates an immutable copy of a `SMFSchemaType` value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
        `instance` - The instance to copy
      Returns:
        A copied immutable SMFSchema instance

    - #### builder

          public static SMFSchema.Builder builder()

      Creates a builder for `SMFSchema`.

           SMFSchema.builder()
              .setSchemaIdentifier(com.io7m.smfj.core.SMFSchemaIdentifier) // required schemaIdentifier
              .putRequiredAttributes|putAllRequiredAttributes(com.io7m.smfj.core.SMFAttributeName => SMFSchemaAttribute) // requiredAttributes mappings
              .putOptionalAttributes|putAllOptionalAttributes(com.io7m.smfj.core.SMFAttributeName => SMFSchemaAttribute) // optionalAttributes mappings
              .setRequiredCoordinateSystem(com.io7m.smfj.core.SMFCoordinateSystem) // optional requiredCoordinateSystem
              .setAllowExtraAttributes(com.io7m.smfj.validation.api.SMFSchemaAllowExtraAttributes) // optional allowExtraAttributes
              .setRequireTriangles(com.io7m.smfj.validation.api.SMFSchemaRequireTriangles) // optional requireTriangles
              .setRequireVertices(com.io7m.smfj.validation.api.SMFSchemaRequireVertices) // optional requireVertices
              .build();

      Returns:
        A new SMFSchema builder