Class SchemaOptions

java.lang.Object
java.util.AbstractMap<String,Object>
java.util.HashMap<String,Object>
org.refcodes.factory.Options
org.refcodes.schema.SchemaOptions
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>

public class SchemaOptions extends org.refcodes.factory.Options

The SchemaOptions represent a set of options influencing how a Schemable instance renders its Schema.

The options are expressed as key/value pairs and stored internally in a Map. In addition to generic map-style access, this class provides typed convenience accessors for commonly used options such as LIMIT.

The interpretation of individual option keys and values is intentionally left to the respective Schemable implementation. This makes the SchemaOptions generic and reusable across different domains and schema-producing components.

Instances of this class are typically created using the nested SchemaOptions.Builder.

See Also:
  • Field Details

    • LIMIT

      public static final String LIMIT

      Key identifying a limit option.

      The associated value is expected to be an Integer. Its semantic meaning (for example, limiting the number of repeated elements rendered in a schema) is defined by the Schemable implementation consuming this option.

      See Also:
  • Constructor Details

    • SchemaOptions

      protected SchemaOptions()

      Protected default constructor.

      Instances are typically created via the SchemaOptions.Builder.

    • SchemaOptions

      protected SchemaOptions(Map<String,Object> aOptions)
      Instantiates a new SchemaOptions instance from the given options.
      Parameters:
      aOptions - The options from which to populate the SchemaOptions
  • Method Details

    • getLimit

      public int getLimit()

      Returns the configured limit value.

      This is a convenience method equivalent to calling getLimitOr(int) with -1 as the default value.

      Returns:
      the configured limit value, or -1 if no limit is set
    • getLimitOr

      public int getLimitOr(int aValue)
      Returns the configured limit value or the provided default.
      Parameters:
      aValue - the default value to return if no limit is present
      Returns:
      the configured limit value or aValue if absent
    • builder

      public static SchemaOptions.Builder builder()
      Creates a new SchemaOptions.Builder for constructing SchemaOptions instances.
      Returns:
      a new builder instance