Class SMFSchema.Builder

  • Enclosing class:
    SMFSchema

    public static final class SMFSchema.Builder
    extends java.lang.Object
    Builds instances of type SMFSchema. Initialize attributes and then invoke the build() method to create an immutable instance.

    Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

    • Method Detail

      • from

        public final SMFSchema.Builder from​(SMFSchemaType instance)
        Fill a builder with attribute values from the provided SMFSchemaType instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • setSchemaIdentifier

        public final SMFSchema.Builder setSchemaIdentifier​(SMFSchemaIdentifier schemaIdentifier)
        Initializes the value for the schemaIdentifier attribute.
        Parameters:
        schemaIdentifier - The value for schemaIdentifier
        Returns:
        this builder for use in a chained invocation
      • putRequiredAttributes

        public final SMFSchema.Builder putRequiredAttributes​(SMFAttributeName key,
                                                             SMFSchemaAttribute value)
        Put one entry to the requiredAttributes map.
        Parameters:
        key - The key in the requiredAttributes map
        value - The associated value in the requiredAttributes map
        Returns:
        this builder for use in a chained invocation
      • setRequiredAttributes

        public final SMFSchema.Builder setRequiredAttributes​(java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> entries)
        Sets or replaces all mappings from the specified map as entries for the requiredAttributes map. Nulls are not permitted
        Parameters:
        entries - The entries that will be added to the requiredAttributes map
        Returns:
        this builder for use in a chained invocation
      • putAllRequiredAttributes

        public final SMFSchema.Builder putAllRequiredAttributes​(java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> entries)
        Put all mappings from the specified map as entries to requiredAttributes map. Nulls are not permitted
        Parameters:
        entries - The entries that will be added to the requiredAttributes map
        Returns:
        this builder for use in a chained invocation
      • putOptionalAttributes

        public final SMFSchema.Builder putOptionalAttributes​(SMFAttributeName key,
                                                             SMFSchemaAttribute value)
        Put one entry to the optionalAttributes map.
        Parameters:
        key - The key in the optionalAttributes map
        value - The associated value in the optionalAttributes map
        Returns:
        this builder for use in a chained invocation
      • setOptionalAttributes

        public final SMFSchema.Builder setOptionalAttributes​(java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> entries)
        Sets or replaces all mappings from the specified map as entries for the optionalAttributes map. Nulls are not permitted
        Parameters:
        entries - The entries that will be added to the optionalAttributes map
        Returns:
        this builder for use in a chained invocation
      • putAllOptionalAttributes

        public final SMFSchema.Builder putAllOptionalAttributes​(java.util.Map<? extends SMFAttributeName,​? extends SMFSchemaAttribute> entries)
        Put all mappings from the specified map as entries to optionalAttributes map. Nulls are not permitted
        Parameters:
        entries - The entries that will be added to the optionalAttributes map
        Returns:
        this builder for use in a chained invocation
      • setRequiredCoordinateSystem

        public final SMFSchema.Builder setRequiredCoordinateSystem​(SMFCoordinateSystem requiredCoordinateSystem)
        Initializes the optional value requiredCoordinateSystem to requiredCoordinateSystem.
        Parameters:
        requiredCoordinateSystem - The value for requiredCoordinateSystem
        Returns:
        this builder for chained invocation
      • setRequiredCoordinateSystem

        public final SMFSchema.Builder setRequiredCoordinateSystem​(java.util.Optional<? extends SMFCoordinateSystem> requiredCoordinateSystem)
        Initializes the optional value requiredCoordinateSystem to requiredCoordinateSystem.
        Parameters:
        requiredCoordinateSystem - The value for requiredCoordinateSystem
        Returns:
        this builder for use in a chained invocation
      • setAllowExtraAttributes

        public final SMFSchema.Builder setAllowExtraAttributes​(SMFSchemaAllowExtraAttributes allowExtraAttributes)
        Initializes the value for the allowExtraAttributes attribute.

        If not set, this attribute will have a default value as returned by the initializer of allowExtraAttributes.

        Parameters:
        allowExtraAttributes - The value for allowExtraAttributes
        Returns:
        this builder for use in a chained invocation
      • setRequireTriangles

        public final SMFSchema.Builder setRequireTriangles​(SMFSchemaRequireTriangles requireTriangles)
        Initializes the value for the requireTriangles attribute.

        If not set, this attribute will have a default value as returned by the initializer of requireTriangles.

        Parameters:
        requireTriangles - The value for requireTriangles
        Returns:
        this builder for use in a chained invocation
      • setRequireVertices

        public final SMFSchema.Builder setRequireVertices​(SMFSchemaRequireVertices requireVertices)
        Initializes the value for the requireVertices attribute.

        If not set, this attribute will have a default value as returned by the initializer of requireVertices.

        Parameters:
        requireVertices - The value for requireVertices
        Returns:
        this builder for use in a chained invocation
      • build

        public SMFSchema build()
        Builds a new SMFSchema.
        Returns:
        An immutable instance of SMFSchema
        Throws:
        java.lang.IllegalStateException - if any required attributes are missing