public final class ConfigDataLocation extends Object implements OriginProvider
resolved
to
one or config data resources
. A ConfigDataLocation
is a simple wrapper around a String
value. The exact format of the value will
depend on the underlying technology, but is usually a URL like syntax consisting of a
prefix and path. For example, crypt:somehost/somepath
.
Locations can be mandatory or optional
. Optional locations are
prefixed with optional:
.
Modifier and Type | Field and Description |
---|---|
static String |
OPTIONAL_PREFIX
Prefix used to indicate that a
ConfigDataResource is optional. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getNonPrefixedValue(String prefix)
Return
getValue() with the specified prefix removed. |
Origin |
getOrigin()
Return the source origin or
null if the origin is not known. |
String |
getValue()
Return the value of the location (always excluding any user specified
optional: prefix. |
int |
hashCode() |
boolean |
hasPrefix(String prefix)
Return if
getValue() has the specified prefix. |
boolean |
isOptional()
Return the the location is optional and should ignore
ConfigDataNotFoundException . |
static ConfigDataLocation |
of(String location)
Factory method to create a new
ConfigDataLocation from a string. |
String |
toString() |
public static final String OPTIONAL_PREFIX
ConfigDataResource
is optional.public boolean isOptional()
ConfigDataNotFoundException
.public String getValue()
optional:
prefix.public boolean hasPrefix(String prefix)
getValue()
has the specified prefix.prefix
- the prefix to checkpublic String getNonPrefixedValue(String prefix)
getValue()
with the specified prefix removed. If the location does
not have the given prefix then the getValue()
is returned unchanged.prefix
- the prefix to checkpublic Origin getOrigin()
OriginProvider
null
if the origin is not known.getOrigin
in interface OriginProvider
null
public static ConfigDataLocation of(String location)
ConfigDataLocation
from a string.location
- the location stringConfigDataLocation
instance or null
if no location was
provided