Package org.springframework.core.env
Class EnumerablePropertySource<T>
java.lang.Object
org.springframework.core.env.PropertySource<T>
org.springframework.core.env.EnumerablePropertySource<T>
- Type Parameters:
- T- the source type
- Direct Known Subclasses:
- CommandLinePropertySource,- CompositePropertySource,- MapPropertySource,- ServletConfigPropertySource,- ServletContextPropertySource
A 
PropertySource implementation capable of interrogating its
 underlying source object to enumerate all possible property name/value
 pairs. Exposes the getPropertyNames() method to allow callers
 to introspect available properties without having to access the underlying
 source object. This also facilitates a more efficient implementation of
 containsProperty(String), in that it can call getPropertyNames()
 and iterate through the returned array rather than attempting a call to
 PropertySource.getProperty(String) which may be more expensive. Implementations may
 consider caching the result of getPropertyNames() to fully exploit this
 performance opportunity.
 Most framework-provided PropertySource implementations are enumerable;
 a counter-example would be JndiPropertySource where, due to the
 nature of JNDI it is not possible to determine all possible property names at
 any given time; rather it is only possible to try to access a property
 (via PropertySource.getProperty(String)) in order to evaluate whether it is present
 or not.
- Since:
- 3.1
- Author:
- Chris Beams, Juergen Hoeller
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.core.env.PropertySourcePropertySource.StubPropertySource
- 
Field SummaryFields inherited from class org.springframework.core.env.PropertySourcelogger, name, source
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedCreate a newEnumerablePropertySourcewith the given name and with a newObjectinstance as the underlying source.EnumerablePropertySource(String name, T source) Create a newEnumerablePropertySourcewith the given name and source object.
- 
Method SummaryModifier and TypeMethodDescriptionbooleancontainsProperty(String name) Return whether thisPropertySourcecontains a property with the given name.abstract String[]Return the names of all properties contained by the source object (nevernull).Methods inherited from class org.springframework.core.env.PropertySourceequals, getName, getProperty, getSource, hashCode, named, toString
- 
Constructor Details- 
EnumerablePropertySourceCreate a newEnumerablePropertySourcewith the given name and source object.- Parameters:
- name- the associated name
- source- the source object
 
- 
EnumerablePropertySourceCreate a newEnumerablePropertySourcewith the given name and with a newObjectinstance as the underlying source.- Parameters:
- name- the associated name
 
 
- 
- 
Method Details- 
containsPropertyReturn whether thisPropertySourcecontains a property with the given name.This implementation checks for the presence of the given name within the getPropertyNames()array.- Overrides:
- containsPropertyin class- PropertySource<T>
- Parameters:
- name- the name of the property to find
 
- 
getPropertyNamesReturn the names of all properties contained by the source object (nevernull).
 
-