org.springframework.core.env

Class MutablePropertySources

  • java.lang.Object
    • org.springframework.core.env.MutablePropertySources
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addAfter(java.lang.String relativePropertySourceName, PropertySource<?> propertySource)
      Add the given property source object with precedence immediately lower than the named relative property source.
      void addBefore(java.lang.String relativePropertySourceName, PropertySource<?> propertySource)
      Add the given property source object with precedence immediately higher than the named relative property source.
      void addFirst(PropertySource<?> propertySource)
      Add the given property source object with highest precedence.
      void addLast(PropertySource<?> propertySource)
      Add the given property source object with lowest precedence.
      protected void assertLegalRelativeAddition(java.lang.String relativePropertySourceName, PropertySource<?> propertySource)
      Ensure that the given property source is not being added relative to itself.
      boolean contains(java.lang.String name)
      Return whether a property source with the given name is contained.
      PropertySource<?> get(java.lang.String name)
      Return the property source with the given name, null if not found.
      java.util.Iterator<PropertySource<?>> iterator() 
      int precedenceOf(PropertySource<?> propertySource)
      Return the precedence of the given property source, -1 if not found.
      PropertySource<?> remove(java.lang.String name)
      Remove and return the property source with the given name, null if not found.
      protected void removeIfPresent(PropertySource<?> propertySource)
      Remove the given property source if it is present.
      void replace(java.lang.String name, PropertySource<?> propertySource)
      Replace the property source with the given name with the given property source object.
      int size()
      Return the number of PropertySource objects contained.
      java.util.Spliterator<PropertySource<?>> spliterator() 
      java.util.stream.Stream<PropertySource<?>> stream()
      Return a sequential Stream containing the property sources.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Constructor Detail

      • MutablePropertySources

        public MutablePropertySources(PropertySources propertySources)
        Create a new MutablePropertySources from the given propertySources object, preserving the original order of contained PropertySource objects.
    • Method Detail

      • iterator

        public java.util.Iterator<PropertySource<?>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<PropertySource<?>>
      • spliterator

        public java.util.Spliterator<PropertySource<?>> spliterator()
        Specified by:
        spliterator in interface java.lang.Iterable<PropertySource<?>>
      • addFirst

        public void addFirst(PropertySource<?> propertySource)
        Add the given property source object with highest precedence.
      • addLast

        public void addLast(PropertySource<?> propertySource)
        Add the given property source object with lowest precedence.
      • addBefore

        public void addBefore(java.lang.String relativePropertySourceName,
                              PropertySource<?> propertySource)
        Add the given property source object with precedence immediately higher than the named relative property source.
      • addAfter

        public void addAfter(java.lang.String relativePropertySourceName,
                             PropertySource<?> propertySource)
        Add the given property source object with precedence immediately lower than the named relative property source.
      • precedenceOf

        public int precedenceOf(PropertySource<?> propertySource)
        Return the precedence of the given property source, -1 if not found.
      • remove

        @Nullable
        public PropertySource<?> remove(java.lang.String name)
        Remove and return the property source with the given name, null if not found.
        Parameters:
        name - the name of the property source to find and remove
      • replace

        public void replace(java.lang.String name,
                            PropertySource<?> propertySource)
        Replace the property source with the given name with the given property source object.
        Parameters:
        name - the name of the property source to find and replace
        propertySource - the replacement property source
        Throws:
        java.lang.IllegalArgumentException - if no property source with the given name is present
        See Also:
        contains(java.lang.String)
      • size

        public int size()
        Return the number of PropertySource objects contained.
      • toString

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

        protected void assertLegalRelativeAddition(java.lang.String relativePropertySourceName,
                                                   PropertySource<?> propertySource)
        Ensure that the given property source is not being added relative to itself.
      • removeIfPresent

        protected void removeIfPresent(PropertySource<?> propertySource)
        Remove the given property source if it is present.