public class CompositePropertySource extends EnumerablePropertySource<ObjectSE>
PropertySource
インスタンスを反復処理する複合 PropertySource
実装。複数のプロパティソースが同じ名前を共有する場合に必要です。@PropertySource
に複数の値が提供されている場合。Spring 4.1.2 の時点で、このクラスはプレーン PropertySource
の代わりに EnumerablePropertySource
を継承し、含まれているすべてのソースからの累積プロパティ名に基づいて getPropertyNames()
を公開します(可能な限り)。
PropertySource.StubPropertySource
logger, name, source
コンストラクターと説明 |
---|
CompositePropertySource(StringSE name) 新しい CompositePropertySource を作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
void | addFirstPropertySource(PropertySource<?> propertySource) 指定された PropertySource をチェーンの先頭に追加します。 |
void | addPropertySource(PropertySource<?> propertySource) 指定された PropertySource をチェーンの末尾に追加します。 |
boolean | containsProperty(StringSE name) この PropertySource に、指定された名前のプロパティが含まれているかどうかを返します。 |
ObjectSE | getProperty(StringSE name) 指定された名前に関連付けられた値を返します。見つからない場合は null を返します。 |
StringSE[] | getPropertyNames() ソースオブジェクトに含まれるすべてのプロパティの名前を返します( null は決してしないでください)。 |
CollectionSE<PropertySource<?>> | getPropertySources() この複合ソースが保持するすべてのプロパティソースを返します。 |
StringSE | toString() 現在のログレベルにデバッグが含まれていない場合は、簡潔な出力(型と名前)を生成します。 |
equals, getName, getSource, hashCode, named
cloneSE, finalizeSE, getClassSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
public CompositePropertySource(StringSE name)
CompositePropertySource
を作成します。name
- プロパティソースの名前 @Nullable public ObjectSE getProperty(StringSE name)
PropertySource
null
を返します。PropertySource<ObjectSE>
の getProperty
name
- 検索するプロパティ PropertyResolver.getRequiredProperty(String)
public boolean containsProperty(StringSE name)
EnumerablePropertySource
PropertySource
に、指定された名前のプロパティが含まれているかどうかを返します。 この実装は、EnumerablePropertySource.getPropertyNames()
配列内の指定された名前の存在を確認します。
EnumerablePropertySource<ObjectSE>
の containsProperty
name
- 検索するプロパティの名前 public StringSE[] getPropertyNames()
EnumerablePropertySource
null
は決してしないでください)。EnumerablePropertySource<ObjectSE>
の getPropertyNames
public void addPropertySource(PropertySource<?> propertySource)
PropertySource
をチェーンの末尾に追加します。propertySource
- 追加する PropertySourcepublic void addFirstPropertySource(PropertySource<?> propertySource)
PropertySource
をチェーンの先頭に追加します。propertySource
- 追加する PropertySourcepublic CollectionSE<PropertySource<?>> getPropertySources()
public StringSE toString()
PropertySource
この変数の冗長性は、システムプロパティや環境変数などのプロパティソースに任意の数のプロパティペアが含まれている可能性があり、読み取りが困難な例外やログメッセージにつながる可能性があるため便利です。
PropertySource<ObjectSE>
の toString
Log.isDebugEnabled()