Class CosIdSpecs
java.lang.Object
me.ahoo.cosid.spring.autoconfigure.CosIdSpecs
CosIdProperties to RuntimeSpec (07-runtime-and-spring.md ยง4.1): toSpec(me.ahoo.cosid.spring.autoconfigure.CosIdProperties, java.time.ZoneId) is a pure function,
no Spring involved; bind(java.lang.Iterable<org.springframework.boot.context.properties.source.ConfigurationPropertySource>, org.springframework.boot.context.properties.bind.PlaceholdersResolver) binds cosid.* strictly. It checks what the properties alone can tell (a missing strategy, a codec item naming two codecs, ...) and reports
every problem at once by property path; CosIdRuntime.start validates the spec as a whole.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic CosIdPropertiesbind(Iterable<org.springframework.boot.context.properties.source.ConfigurationPropertySource> sources, org.springframework.boot.context.properties.bind.PlaceholdersResolver placeholders) Bindscosid.*; a key that binds to nothing fails (R1-spring-03): a typo would otherwise fall back to the default silently.static me.ahoo.cosid.runtime.RuntimeSpectoSpec(CosIdProperties properties, String namespace, ZoneId zone) Maps the properties to a spec.static me.ahoo.cosid.runtime.RuntimeSpectoSpec(CosIdProperties properties, ZoneId zone) Maps the properties to a spec, incosid.namespaceor "cosid".
-
Field Details
-
SNOWFLAKE
- See Also:
-
COSID80
- See Also:
-
SEGMENT
- See Also:
-
PERIODIC_SEGMENT
- See Also:
-
CUSTOM
The strategy of a user generator (GeneratorSpec.CustomorInstance) indescribe().- See Also:
-
UUIDV7
UUIDv7 ids (D46): no machine, store nor codec.- See Also:
-
-
Method Details
-
bind
public static CosIdProperties bind(Iterable<org.springframework.boot.context.properties.source.ConfigurationPropertySource> sources, org.springframework.boot.context.properties.bind.PlaceholdersResolver placeholders) Bindscosid.*; a key that binds to nothing fails (R1-spring-03): a typo would otherwise fall back to the default silently.cosid.stores.*.options, the keys of the integrations and the server, and system properties and environment variables are not checked here.- Parameters:
sources- the property sources, such asConfigurationPropertySources.get(environment)placeholders- resolves${...}in the values- Returns:
- the properties
- Throws:
org.springframework.boot.context.properties.bind.BindException- with the unbound keys
-
namespace
- Parameters:
configured-cosid.namespace, or nullapplicationName-spring.application.name, or null- Returns:
- the namespace; empty when both are unset, for "cosid"
- Throws:
me.ahoo.cosid.CosIdException- if the application name is no valid namespace
-
toSpec
Maps the properties to a spec, incosid.namespaceor "cosid".- Parameters:
properties- the bound propertieszone- the zone of the zone-dependent settings left empty (the system zone in an application)- Returns:
- the spec
- Throws:
me.ahoo.cosid.CosIdException- listing every problem by property path
-
toSpec
public static me.ahoo.cosid.runtime.RuntimeSpec toSpec(CosIdProperties properties, String namespace, ZoneId zone) Maps the properties to a spec.- Parameters:
properties- the bound propertiesnamespace- the namespace of the runtime, resolved bynamespace(String, String)zone- the zone of the zone-dependent settings left empty (the system zone in an application)- Returns:
- the spec
- Throws:
me.ahoo.cosid.CosIdException- listing every problem by property path
-