T
- ソース型 public abstract class EnumerablePropertySource<T> extends PropertySource<T>
PropertySource
の実装です。呼び出し元がソースオブジェクトにアクセスせずに利用可能なプロパティを参照できるようにするために, getPropertyNames()
メソッドを公開しています。これはまた、containsProperty(String)
のより効率的な実装を容易にします。これは、より高負荷な PropertySource.getProperty(String)
の呼び出しを試みるよりも, getPropertyNames()
を呼び出して返された配列を繰り返し処理することができるという点です。実装では,この性能を十分に利用するために、getPropertyNames()
の結果をキャッシュすることを検討することができます。 フレームワークが提供するほとんどの PropertySource
実装は列挙可能です。反例は JndiPropertySource
であり、JNDI の性質上、すべての可能なプロパティ名を特定の時点で決定することは不可能です。むしろ、プロパティが存在するかどうかを評価するために(PropertySource.getProperty(String)
を介して)プロパティへのアクセスを試みることのみが可能です。
PropertySource.StubPropertySource
logger, name, source
修飾子 | コンストラクターと説明 |
---|---|
protected | EnumerablePropertySource(java.lang.String name) |
| EnumerablePropertySource(java.lang.String name, T source) |
修飾子と型 | メソッドと説明 |
---|---|
boolean | containsProperty(java.lang.String name) この PropertySource に、指定された名前のプロパティが含まれているかどうかを返します。 |
abstract java.lang.String[] | getPropertyNames() ソースオブジェクトに含まれるすべてのプロパティの名前を返します( null は決してしないでください)。 |
equals, getName, getProperty, getSource, hashCode, named, toString
public EnumerablePropertySource(java.lang.String name, T source)
protected EnumerablePropertySource(java.lang.String name)
public boolean containsProperty(java.lang.String name)
PropertySource
に、指定された名前のプロパティが含まれているかどうかを返します。 この実装は、getPropertyNames()
配列内の指定された名前の存在を確認します。
PropertySource<T>
の containsProperty
name
- 検索するプロパティの名前 public abstract java.lang.String[] getPropertyNames()
null
は決してしないでください)。