Interface VetoableConfig
-
- All Superinterfaces:
PropertiesConfigSource
- All Known Implementing Classes:
FileUrlPropertiesConfigSource
public interface VetoableConfig extends PropertiesConfigSource
APropertiesConfigSourcethat may refuse to supply configuration at all, rather than merely failing to find any.The distinction matters because these are different events. A source that cannot find its configuration is ordinary: the path is dropped, a log item is recorded, and the remaining sources are read. A source that vetoes is saying something stronger — that the configuration it found must not be used, and that proceeding as though it were simply absent would be wrong.
FileUrlPropertiesConfigSourcevetoes, for example, when a file it was told to treat as private turns out to be readable by anyone.A veto is signalled by throwing
ConfigVetoedException, which is checked. Only a VetoableConfig should throw one.Implementing this interface does not merely permit a veto; it changes who may use the source. Whether an identifier is vetoable is decided from the source class alone, before anything is read, so:
MConfig.AsProvidedVetoableaccepts such identifiers. Its methods declarethrows ConfigVetoedException, so a caller cannot use them without deciding what a veto should mean to the application.MConfig.AsProvidedrefuses them outright, with an IllegalArgumentException naming the vetoable facade. Every path it reads was named by the caller in code, so this is a programmer error, caught before any file is opened. Note that the refusal follows from the source class, not from the particular identifier: an identifier is refused even when nothing about it could actually provoke a veto.MConfig.WithTraditionalDefaultSourcesignores the veto, dropping that one source with a warning and reading the rest. Its resource paths may come from resource-path text files the application never wrote, so a veto there reflects an end user's configuration choice, and must not be able to abort a read that never opted in.
See
MConfigfor the model as a whole, andPropertiesConfigSourcefor the requirements every source must meet.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.mchange.v2.cfg.PropertiesConfigSource
PropertiesConfigSource.Parse
-
-
Method Summary
-
Methods inherited from interface com.mchange.v2.cfg.PropertiesConfigSource
propertiesFromSource
-
-