Class ConfigDataLocation
java.lang.Object
org.springframework.boot.context.config.ConfigDataLocation
- All Implemented Interfaces:
OriginProvider
A user specified location that can be
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:
.
- Since:
- 2.4.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Prefix used to indicate that aConfigDataResource
is optional. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getNonPrefixedValue
(String prefix) ReturngetValue()
with the specified prefix removed.Return the source origin ornull
if the origin is not known.getValue()
Return the value of the location (always excluding any user specifiedoptional:
prefix).int
hashCode()
boolean
Return ifgetValue()
has the specified prefix.boolean
Return if the location is optional and should ignoreConfigDataNotFoundException
.static ConfigDataLocation
Factory method to create a newConfigDataLocation
from a string.split()
Return an array ofConfigDataLocation
elements built by splitting thisConfigDataLocation
around a delimiter of";"
.Return an array ofConfigDataLocation
elements built by splitting thisConfigDataLocation
around the specified delimiter.toString()
-
Field Details
-
OPTIONAL_PREFIX
Prefix used to indicate that aConfigDataResource
is optional.- See Also:
-
-
Method Details
-
isOptional
public boolean isOptional()Return if the location is optional and should ignoreConfigDataNotFoundException
.- Returns:
- if the location is optional
-
getValue
Return the value of the location (always excluding any user specifiedoptional:
prefix).- Returns:
- the location value
-
hasPrefix
Return ifgetValue()
has the specified prefix.- Parameters:
prefix
- the prefix to check- Returns:
- if the value has the prefix
-
getNonPrefixedValue
ReturngetValue()
with the specified prefix removed. If the location does not have the given prefix then thegetValue()
is returned unchanged.- Parameters:
prefix
- the prefix to check- Returns:
- the value with the prefix removed
-
getOrigin
Description copied from interface:OriginProvider
Return the source origin ornull
if the origin is not known.- Specified by:
getOrigin
in interfaceOriginProvider
- Returns:
- the origin or
null
-
split
Return an array ofConfigDataLocation
elements built by splitting thisConfigDataLocation
around a delimiter of";"
.- Returns:
- the split locations
- Since:
- 2.4.7
-
split
Return an array ofConfigDataLocation
elements built by splitting thisConfigDataLocation
around the specified delimiter.- Parameters:
delimiter
- the delimiter to split on- Returns:
- the split locations
- Since:
- 2.4.7
-
equals
-
hashCode
public int hashCode() -
toString
-
of
Factory method to create a newConfigDataLocation
from a string.- Parameters:
location
- the location string- Returns:
- a
ConfigDataLocation
instance ornull
if no location was provided
-