Package net.morimekta.providence.config
Class ReferenceConfigSupplier<RefMessage extends net.morimekta.providence.PMessage<RefMessage,RefField>,RefField extends net.morimekta.providence.descriptor.PField,ParentMessage extends net.morimekta.providence.PMessage<ParentMessage,ParentField>,ParentField extends net.morimekta.providence.descriptor.PField>
- java.lang.Object
-
- net.morimekta.providence.config.impl.UpdatingConfigSupplier<RefMessage,RefField>
-
- net.morimekta.providence.config.ReferenceConfigSupplier<RefMessage,RefField,ParentMessage,ParentField>
-
- All Implemented Interfaces:
java.util.function.Supplier<RefMessage>
,ConfigSupplier<RefMessage,RefField>
public class ReferenceConfigSupplier<RefMessage extends net.morimekta.providence.PMessage<RefMessage,RefField>,RefField extends net.morimekta.providence.descriptor.PField,ParentMessage extends net.morimekta.providence.PMessage<ParentMessage,ParentField>,ParentField extends net.morimekta.providence.descriptor.PField> extends UpdatingConfigSupplier<RefMessage,RefField>
A supplier to get a config (aka message) from a resource location. This is a fixed static supplier, so listening to changes will never do anything.ConfigSupplier<Service, Service._Field> supplier = new ResourceConfigSupplier<>(referencePath, Service.kDescriptor);
-
-
Constructor Summary
Constructors Constructor Description ReferenceConfigSupplier(java.lang.String referencePath, ConfigSupplier<ParentMessage,ParentField> parent)
Create a config that wraps a providence message instance, and fetches a message from within that parent config.ReferenceConfigSupplier(java.lang.String referencePath, ConfigSupplier<ParentMessage,ParentField> parent, java.time.Clock clock)
Create a config that wraps a providence message instance, and fetches a message from within that parent config.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getName()
Get a simple descriptive name for this config supplier.java.lang.String
toString()
-
Methods inherited from interface net.morimekta.providence.config.ConfigSupplier
snapshot
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from class net.morimekta.providence.config.impl.UpdatingConfigSupplier
addListener, configTimestamp, get, removeListener, set
-
-
-
-
Constructor Detail
-
ReferenceConfigSupplier
public ReferenceConfigSupplier(@Nonnull java.lang.String referencePath, @Nonnull ConfigSupplier<ParentMessage,ParentField> parent) throws ProvidenceConfigException
Create a config that wraps a providence message instance, and fetches a message from within that parent config. It is not allowed to have it return a null, meaning for the reference config to be valid, the reference must exist.- Parameters:
referencePath
- The resource name to load.parent
- The message type descriptor.- Throws:
ProvidenceConfigException
- If message overriding failed
-
ReferenceConfigSupplier
public ReferenceConfigSupplier(java.lang.String referencePath, ConfigSupplier<ParentMessage,ParentField> parent, java.time.Clock clock) throws ProvidenceConfigException
Create a config that wraps a providence message instance, and fetches a message from within that parent config. It is not allowed to have it return a null, meaning for the reference config to be valid, the reference must exist.- Parameters:
referencePath
- The resource name to load.parent
- The message type descriptor.clock
- The clock to use for timing.- Throws:
ProvidenceConfigException
- If message overriding failed
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getName
public java.lang.String getName()
Description copied from interface:ConfigSupplier
Get a simple descriptive name for this config supplier.- Returns:
- The supplier name.
-
-