类 PropertySources

java.lang.Object
cn.taketoday.core.env.PropertySources
所有已实现的接口:
Iterable<PropertySource<?>>

public class PropertySources extends Object implements Iterable<PropertySource<?>>
Holder containing one or more PropertySource objects.

Allows manipulation of contained property sources and provides a constructor for copying an existing PropertySources instance.

Where precedence is mentioned in methods such as addFirst(cn.taketoday.core.env.PropertySource<?>) and addLast(cn.taketoday.core.env.PropertySource<?>), this is with regard to the order in which property sources will be searched when resolving a given property with a PropertyResolver.

从以下版本开始:
4.0
作者:
Chris Beams, Juergen Hoeller, Harry Yang
另请参阅:
  • 字段详细资料

  • 构造器详细资料

    • PropertySources

      public PropertySources()
      Create a new PropertySources object.
    • PropertySources

      public PropertySources(PropertySources propertySources)
      Create a new PropertySources from the given propertySources object, preserving the original order of contained PropertySource objects.
  • 方法详细资料

    • iterator

      public Iterator<PropertySource<?>> iterator()
      指定者:
      iterator 在接口中 Iterable<PropertySource<?>>
    • spliterator

      public Spliterator<PropertySource<?>> spliterator()
      指定者:
      spliterator 在接口中 Iterable<PropertySource<?>>
    • stream

      public Stream<PropertySource<?>> stream()
      Return a sequential Stream containing the property sources.
    • contains

      public boolean contains(String name)
      Return whether a property source with the given name is contained.
      参数:
      name - the name of the property source to find
    • get

      @Nullable public PropertySource<?> get(String name)
      Return the property source with the given name, null if not found.
      参数:
      name - the name of the property source to find
    • 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(String relativePropertySourceName, PropertySource<?> propertySource)
      Add the given property source object with precedence immediately higher than the named relative property source.
    • addAfter

      public void addAfter(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(String name)
      Remove and return the property source with the given name, null if not found.
      参数:
      name - the name of the property source to find and remove
    • replace

      public void replace(String name, PropertySource<?> propertySource)
      Replace the property source with the given name with the given property source object.
      参数:
      name - the name of the property source to find and replace
      propertySource - the replacement property source
      抛出:
      IllegalArgumentException - if no property source with the given name is present
      另请参阅:
    • size

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

      public String toString()
      覆盖:
      toString 在类中 Object
    • assertLegalRelativeAddition

      protected void assertLegalRelativeAddition(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.
    • addAtIndex

      private void addAtIndex(int index, PropertySource<?> propertySource)
      Add the given property source at a particular index in the list.
    • assertPresentAndGetIndex

      private int assertPresentAndGetIndex(String name)
      Assert that the named property source is present and return its index.
      参数:
      name - name of the property source to find
      抛出:
      IllegalArgumentException - if the named property source is not present