de.smartics.properties.spi.config.support
Class PropertiesPropertyProvider

Package class diagram package PropertiesPropertyProvider
java.lang.Object
  extended by de.smartics.properties.spi.config.support.PropertiesPropertyProvider
All Implemented Interfaces:
PropertyProvider, Serializable

@NotThreadSafe
public final class PropertiesPropertyProvider
     
     
extends Object
implements PropertyProvider

Provides an adapter for Properties instances to match the PropertyProvider interface.

See Also:
Serialized Form

Constructor Summary
PropertiesPropertyProvider(ConfigurationKey configurationKey, PropertyLocation sourceId, Properties properties)
          Default constructor.
 
Method Summary
 boolean containsKey(String name)
          Checks if a given property is provided by the property provider.
 ConfigurationKey getConfigurationKey()
          The key of the configuration this property provider provides properties for.
 PropertyCollection getProperties()
          Returns the collection of all property values known to the system.
 Property getProperty(String name)
          Returns the property with the given name.
 PropertyLocation getSourceId()
          Returns the unique identifier of the property source.
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertiesPropertyProvider

public PropertiesPropertyProvider(ConfigurationKey configurationKey,
                                  PropertyLocation sourceId,
                                  Properties properties)
                           throws NullPointerException
Default constructor.

Parameters:
configurationKey - the key of the configuration whose properties are provided.
sourceId - the unique identifier of the physical source of the properties.
properties - the wrapped properties.
Throws:
NullPointerException - if either configurationKey , sourceId or properties is null.
Method Detail

getConfigurationKey

public ConfigurationKey getConfigurationKey()
Description copied from interface: PropertyProvider
The key of the configuration this property provider provides properties for.

Specified by:
getConfigurationKey in interface PropertyProvider
Returns:
the key of the configuration this property provider provides properties for.

getSourceId

public PropertyLocation getSourceId()
Description copied from interface: PropertyProvider
Returns the unique identifier of the property source. This value is used to identify the source when reporting about a property.

Specified by:
getSourceId in interface PropertyProvider
Returns:
the unique identifier of the property source.

getProperty

public Property getProperty(String name)
                     throws NullPointerException,
                            IllegalArgumentException
Description copied from interface: PropertyProvider
Returns the property with the given name.

Specified by:
getProperty in interface PropertyProvider
Parameters:
name - the name of the property to fetch.
Returns:
the value to the property.
Throws:
NullPointerException - if name is null.
IllegalArgumentException - if the property is not known. A property is not known if its key has not been registered. A property that is registered with the null value is known.

getProperties

public PropertyCollection getProperties()
Description copied from interface: PropertyProvider
Returns the collection of all property values known to the system.

Specified by:
getProperties in interface PropertyProvider
Returns:
the collection of all property values known to the system. May be empty, but is never null.

containsKey

public boolean containsKey(String name)
                    throws NullPointerException
Description copied from interface: PropertyProvider
Checks if a given property is provided by the property provider.

Specified by:
containsKey in interface PropertyProvider
Parameters:
name - the property name to check.
Returns:
true if the provider provides a property for the name, false otherwise.
Throws:
NullPointerException - if name is null.

toString

public String toString()
Returns the string representation of the object.

Overrides:
toString in class Object
Returns:
the string representation of the object.


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.