org.springframework.boot.context.config

Class ConfigDataLocation

  • java.lang.Object
    • org.springframework.boot.context.config.ConfigDataLocation
  • All Implemented Interfaces:
    OriginProvider


    public final class ConfigDataLocation
    extends java.lang.Object
    implements OriginProvider
    A user specified location that can be 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:.

    Since:
    2.4.0
    • Method Detail

      • isOptional

        public boolean isOptional()
        Return the the location is optional and should ignore ConfigDataNotFoundException.
        Returns:
        if the location is optional
      • getValue

        public java.lang.String getValue()
        Return the value of the location (always excluding any user specified optional: prefix.
        Returns:
        the location value
      • hasPrefix

        public boolean hasPrefix(java.lang.String prefix)
        Return if getValue() has the specified prefix.
        Parameters:
        prefix - the prefix to check
        Returns:
        if the value has the prefix
      • getNonPrefixedValue

        public java.lang.String getNonPrefixedValue(java.lang.String prefix)
        Return getValue() with the specified prefix removed. If the location does not have the given prefix then the getValue() is returned unchanged.
        Parameters:
        prefix - the prefix to check
        Returns:
        the value with the prefix removed
      • getOrigin

        public Origin getOrigin()
        Description copied from interface: OriginProvider
        Return the source origin or null if the origin is not known.
        Specified by:
        getOrigin in interface OriginProvider
        Returns:
        the origin or null
      • equals

        public boolean equals(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object