public final class ConfigDataLocation extends java.lang.Object implements OriginProvider
resolved
to
one or more 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 java.lang.String |
OPTIONAL_PREFIX
Prefix used to indicate that a
ConfigDataResource is optional. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getNonPrefixedValue(java.lang.String prefix)
Return
getValue() with the specified prefix removed. |
Origin |
getOrigin()
Return the source origin or
null if the origin is not known. |
java.lang.String |
getValue()
Return the value of the location (always excluding any user specified
optional: prefix. |
int |
hashCode() |
boolean |
hasPrefix(java.lang.String prefix)
Return if
getValue() has the specified prefix. |
boolean |
isOptional()
Return the the location is optional and should ignore
ConfigDataNotFoundException . |
static ConfigDataLocation |
of(java.lang.String location)
Factory method to create a new
ConfigDataLocation from a string. |
ConfigDataLocation[] |
split()
Return an array of
ConfigDataLocation elements built by splitting this
ConfigDataLocation around a delimiter of ";" . |
ConfigDataLocation[] |
split(java.lang.String delimiter)
Return an array of
ConfigDataLocation elements built by splitting this
ConfigDataLocation around the specified delimiter. |
java.lang.String |
toString() |
public static final java.lang.String OPTIONAL_PREFIX
ConfigDataResource
is optional.public boolean isOptional()
ConfigDataNotFoundException
.public java.lang.String getValue()
optional:
prefix.public boolean hasPrefix(java.lang.String prefix)
getValue()
has the specified prefix.prefix
- the prefix to checkpublic java.lang.String getNonPrefixedValue(java.lang.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 ConfigDataLocation[] split()
ConfigDataLocation
elements built by splitting this
ConfigDataLocation
around a delimiter of ";"
.public ConfigDataLocation[] split(java.lang.String delimiter)
ConfigDataLocation
elements built by splitting this
ConfigDataLocation
around the specified delimiter.delimiter
- the delimiter to split onpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static ConfigDataLocation of(java.lang.String location)
ConfigDataLocation
from a string.location
- the location stringConfigDataLocation
instance or null
if no location was
provided