de.smartics.properties.spi.config.support
Class FactoryCache<T extends ConfigurationPropertiesManagement>

Package class diagram package FactoryCache
java.lang.Object
  extended by de.smartics.properties.spi.config.support.FactoryCache<T>
Type Parameters:
T - the type of ConfigurationPropertiesManagement created and stored by this factory cache.

@ThreadSafe
public final class FactoryCache<T extends ConfigurationPropertiesManagement>
     
     
extends Object

Creates and caches configurations.

Required by the ClassPathLoader to store all encountered configuration properties.


Constructor Summary
FactoryCache(ConfigurationRepositoryManagement cache, AbstractConfigurationPropertiesFactory<?> factory)
          Default constructor.
 
Method Summary
 ConfigurationPropertiesManagement createPropertiesManagement(ConfigurationKey<?> key)
          Creates an instance of ConfigurationPropertiesManagement.
 ConfigurationPropertiesManagement ensureManagement(ConfigurationKey<?> key)
          Creates an instance of ConfigurationPropertiesManagement.
 ConfigurationRepositoryManagement getCache()
          Returns the cache of currently loaded configurations.
 PropertiesContext getContext(Class<?> declaringType)
          Returns the context for the given type.
 void registerDescriptors(Map<Class<?>,List<PropertyDescriptor>> descriptorMap)
          Registers the list of descriptors to the given declaring types.
 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

FactoryCache

public FactoryCache(ConfigurationRepositoryManagement cache,
                    AbstractConfigurationPropertiesFactory<?> factory)
Default constructor.

Parameters:
cache - the cache of currently loaded configurations.
factory - the factory to create instances of ConfigurationPropertiesManagement.
Method Detail

getCache

public ConfigurationRepositoryManagement getCache()
Returns the cache of currently loaded configurations.

Returns:
the cache of currently loaded configurations.

getContext

@CheckForNull
public PropertiesContext getContext(Class<?> declaringType)
                             throws NullPointerException,
                                    ConfigException
Returns the context for the given type.

Parameters:
declaringType - the type of a property descriptor.
Returns:
the context for the declared properties. May return null if the declaringType is unknown.
Throws:
ConfigException - if the context for the descriptor cannot be found.
NullPointerException - if declaringType is null.

registerDescriptors

public void registerDescriptors(Map<Class<?>,List<PropertyDescriptor>> descriptorMap)
                         throws NullPointerException
Registers the list of descriptors to the given declaring types.

Parameters:
descriptorMap - a map of declaring types to their associated descriptors.
Throws:
NullPointerException - if descriptorMap or if any key of value of that map is null.

ensureManagement

public ConfigurationPropertiesManagement ensureManagement(ConfigurationKey<?> key)
Creates an instance of ConfigurationPropertiesManagement.

Parameters:
key - the key to the configuration to be created.
Returns:
the created configuration.

createPropertiesManagement

public ConfigurationPropertiesManagement createPropertiesManagement(ConfigurationKey<?> key)
Creates an instance of ConfigurationPropertiesManagement.

Parameters:
key - the key to the configuration to be created.
Returns:
the created configuration.

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.