Record Class CosIdProperties
java.lang.Object
java.lang.Record
me.ahoo.cosid.spring.autoconfigure.CosIdProperties
- Record Components:
enabled- the master switch; default truenamespace- the namespace of the runtime; defaultspring.application.name, elsecosidwith a warning (D38)stores- the stores by name, each declared once and referenced by namemachine- the default machine slot, needed by time-based generators that choose no othermachines- the named machine slots (D37), such as one in a namespace shared by several servicesgenerators- the generators by name;defaultis the one injected without a qualifiermetrics- the Micrometer metrics
@ConfigurationProperties(prefix="cosid")
public record CosIdProperties(boolean enabled, String namespace, Map<String,CosIdProperties.Store> stores, CosIdProperties.Machine machine, Map<String,CosIdProperties.NamedMachine> machines, Map<String,CosIdProperties.Generator> generators, CosIdProperties.Metrics metrics)
extends Record
The
cosid.* configuration (07-runtime-and-spring.md §4.1), bound once and immutable. CosIdSpecs.toSpec(me.ahoo.cosid.spring.autoconfigure.CosIdProperties, java.time.ZoneId)
maps it to a RuntimeSpec; the runtime validates the rest.
This is the binding class: the compatibility promise covers the property keys, their defaults and their checks
(api-freeze.md §0), not this Java type, which may change in any version. A cosid.* key that binds to nothing
fails the start (R1-spring-03), but for cosid.stores.*.options and the keys of the integrations and the server.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordAn item of a codec list: exactly one of its fields.static final recordA date prefix.static final recordA friendly codec.static final recordCounting the ids every generator issues (cosid.generator.generated), through every view the runtime hands out (4.xcosid.metrics.generated.enabled).static final recordA generator.static final recordA slot leased from a store.static final recordThe default machine slot: exactly one ofleasedorstatic.static final recordThe Micrometer metrics.static final recordA named machine slot (D37,cosid.machines.<name>): exactly one ofleasedorstatic, in a namespace of its own.static final recordThe period key of a periodic segment in its text ids (the 4.xgroup-prefix).static final recordA radix codec.static final recordWhat a time-based generator does when the clock goes back.static final recordA slot the deployment keeps unique.static final recordA store. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCosIdProperties(boolean enabled, String namespace, Map<String, CosIdProperties.Store> stores, CosIdProperties.Machine machine, Map<String, CosIdProperties.NamedMachine> machines, Map<String, CosIdProperties.Generator> generators, CosIdProperties.Metrics metrics) Creates an instance of aCosIdPropertiesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanenabled()Returns the value of theenabledrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thegeneratorsrecord component.final inthashCode()Returns a hash code value for this object.machine()Returns the value of themachinerecord component.machines()Returns the value of themachinesrecord component.metrics()Returns the value of themetricsrecord component.Returns the value of thenamespacerecord component.stores()Returns the value of thestoresrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
PREFIX
- See Also:
-
DEFAULT_NAMESPACE
- See Also:
-
-
Constructor Details
-
CosIdProperties
public CosIdProperties(@DefaultValue("true") boolean enabled, String namespace, Map<String, CosIdProperties.Store> stores, CosIdProperties.Machine machine, Map<String, CosIdProperties.NamedMachine> machines, Map<String, CosIdProperties.Generator> generators, @DefaultValue CosIdProperties.Metrics metrics) Creates an instance of aCosIdPropertiesrecord class.- Parameters:
enabled- the value for theenabledrecord componentnamespace- the value for thenamespacerecord componentstores- the value for thestoresrecord componentmachine- the value for themachinerecord componentmachines- the value for themachinesrecord componentgenerators- the value for thegeneratorsrecord componentmetrics- the value for themetricsrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
enabled
public boolean enabled()Returns the value of theenabledrecord component.- Returns:
- the value of the
enabledrecord component
-
namespace
Returns the value of thenamespacerecord component.- Returns:
- the value of the
namespacerecord component
-
stores
Returns the value of thestoresrecord component.- Returns:
- the value of the
storesrecord component
-
machine
Returns the value of themachinerecord component.- Returns:
- the value of the
machinerecord component
-
machines
Returns the value of themachinesrecord component.- Returns:
- the value of the
machinesrecord component
-
generators
Returns the value of thegeneratorsrecord component.- Returns:
- the value of the
generatorsrecord component
-
metrics
Returns the value of themetricsrecord component.- Returns:
- the value of the
metricsrecord component
-