Class SchemaOptions
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,Object>
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:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected default constructor.protectedSchemaOptions(Map<String, Object> aOptions) Instantiates a newSchemaOptionsinstance from the given options. -
Method Summary
Modifier and TypeMethodDescriptionstatic SchemaOptions.Builderbuilder()Creates a newSchemaOptions.Builderfor constructingSchemaOptionsinstances.intgetLimit()Returns the configured limit value.intgetLimitOr(int aValue) Returns the configured limit value or the provided default.Methods inherited from class org.refcodes.factory.Options
get, getOrMethods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
LIMIT
-
-
Constructor Details
-
SchemaOptions
protected SchemaOptions()Protected default constructor.
Instances are typically created via the
SchemaOptions.Builder. -
SchemaOptions
Instantiates a newSchemaOptionsinstance from the given options.- Parameters:
aOptions- The options from which to populate theSchemaOptions
-
-
Method Details
-
getLimit
public int getLimit()Returns the configured limit value.
This is a convenience method equivalent to calling
getLimitOr(int)with-1as the default value.- Returns:
- the configured limit value, or
-1if 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
aValueif absent
-
builder
Creates a newSchemaOptions.Builderfor constructingSchemaOptionsinstances.- Returns:
- a new builder instance
-