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
- Author:
- Phillip Webb
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPrefix used to indicate that aConfigDataResourceis optional. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetNonPrefixedValue(String prefix) ReturngetValue()with the specified prefix removed.Return the source origin ornullif the origin is not known.getValue()Return the value of the location (always excluding any user specifiedoptional:prefix).inthashCode()booleanReturn ifgetValue()has the specified prefix.booleanReturn if the location is optional and should ignoreConfigDataNotFoundException.static ConfigDataLocationFactory method to create a newConfigDataLocationfrom a string.split()Return an array ofConfigDataLocationelements built by splitting thisConfigDataLocationaround a delimiter of";".Return an array ofConfigDataLocationelements built by splitting thisConfigDataLocationaround the specified delimiter.toString()
-
Field Details
-
OPTIONAL_PREFIX
Prefix used to indicate that aConfigDataResourceis 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:OriginProviderReturn the source origin ornullif the origin is not known.- Specified by:
getOriginin interfaceOriginProvider- Returns:
- the origin or
null
-
split
Return an array ofConfigDataLocationelements built by splitting thisConfigDataLocationaround a delimiter of";".- Returns:
- the split locations
- Since:
- 2.4.7
-
split
Return an array ofConfigDataLocationelements built by splitting thisConfigDataLocationaround 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 newConfigDataLocationfrom a string.- Parameters:
location- the location string- Returns:
- a
ConfigDataLocationinstance ornullif no location was provided
-