de.smartics.properties.api.config.domain
Interface PropertyProvider

Package class diagram package PropertyProvider
All Superinterfaces:
Serializable
All Known Subinterfaces:
PropertyManager, PropertySource
All Known Implementing Classes:
DataSourceConfigurationPropertyProvider, InMemoryPropertiesManager, PropertiesPropertyProvider

public interface PropertyProvider
     
     
extends Serializable

Defines an interface to read property values from a source.

See Also:
PropertySource, PropertyManager

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.
 boolean isLazy()
          Providers that do not have to fetch their property definitions eagerly return true here.
 

Method Detail

getSourceId

PropertyLocation getSourceId()
Returns the unique identifier of the property source. This value is used to identify the source when reporting about a property.

Returns:
the unique identifier of the property source.

getConfigurationKey

ConfigurationKey<?> getConfigurationKey()
The key of the configuration this property provider provides properties for.

Returns:
the key of the configuration this property provider provides properties for.

getProperty

@CheckForNull
Property getProperty(String name)
                     throws NullPointerException,
                            IllegalArgumentException
Returns the property with the given name.

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

PropertyCollection getProperties()
Returns the collection of all property values known to the system.

Returns:
the collection of all property values known to the system. May be empty, but is never null.

containsKey

boolean containsKey(String name)
                    throws NullPointerException
Checks if a given property is provided by the property provider.

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.

isLazy

boolean isLazy()
Providers that do not have to fetch their property definitions eagerly return true here. All others return false. Usually providers that fetch properties from a backend store are lazy, while properties on a class path are eager.

Generally: If the provider cannot fetch individual properties easily, then they should fetch them eagerly and hold them in memory. Otherwise they will fetch properties on demand (aka lazily).

Returns:
true if the property provider is lazy, false if it is eager.


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