org.apache.tapestry5.ioc.internal
Class ValidatingMappedConfigurationWrapper<K,V>

java.lang.Object
  extended by org.apache.tapestry5.ioc.internal.AbstractConfigurationImpl<V>
      extended by org.apache.tapestry5.ioc.internal.ValidatingMappedConfigurationWrapper<K,V>
Type Parameters:
K -
V -
All Implemented Interfaces:
MappedConfiguration<K,V>

public class ValidatingMappedConfigurationWrapper<K,V>
extends AbstractConfigurationImpl<V>
implements MappedConfiguration<K,V>

A wrapper around a Map that provides the MappedConfiguration interface, and provides two forms of validation for mapped configurations:

When a warning is logged, the key/value pair is not added to the delegate.

Handles instantiation of instances.


Constructor Summary
ValidatingMappedConfigurationWrapper(Class<V> expectedValueType, ObjectLocator locator, TypeCoercerProxy typeCoercer, Map<K,V> map, Map<K,MappedConfigurationOverride<K,V>> overrides, String serviceId, ContributionDef contributionDef, Class<K> expectedKeyType, Map<K,ContributionDef> keyToContributor)
           
 
Method Summary
 void add(K key, V value)
          Adds a keyed object to the service's contribution.
 void addInstance(K key, Class<? extends V> clazz)
          Adds a keyed object as an instantiated instance (with dependencies injected) of a class.
 void override(K key, V value)
          Overrides an existing contribution by its key.
 void overrideInstance(K key, Class<? extends V> clazz)
          Overrides an existing contribution with a new instance.
 
Methods inherited from class org.apache.tapestry5.ioc.internal.AbstractConfigurationImpl
instantiate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatingMappedConfigurationWrapper

public ValidatingMappedConfigurationWrapper(Class<V> expectedValueType,
                                            ObjectLocator locator,
                                            TypeCoercerProxy typeCoercer,
                                            Map<K,V> map,
                                            Map<K,MappedConfigurationOverride<K,V>> overrides,
                                            String serviceId,
                                            ContributionDef contributionDef,
                                            Class<K> expectedKeyType,
                                            Map<K,ContributionDef> keyToContributor)
Method Detail

add

public void add(K key,
                V value)
Description copied from interface: MappedConfiguration
Adds a keyed object to the service's contribution.

Specified by:
add in interface MappedConfiguration<K,V>
Parameters:
key - unique id for the value
value - to contribute

addInstance

public void addInstance(K key,
                        Class<? extends V> clazz)
Description copied from interface: MappedConfiguration
Adds a keyed object as an instantiated instance (with dependencies injected) of a class. When the value type is an interface and the class to be contributed is a local file, then a reloadable proxy for the value class will be created and contributed.

Specified by:
addInstance in interface MappedConfiguration<K,V>
Parameters:
key - unique id for the value
clazz - class to instantiate and contribute

override

public void override(K key,
                     V value)
Description copied from interface: MappedConfiguration
Overrides an existing contribution by its key.

Specified by:
override in interface MappedConfiguration<K,V>
Parameters:
key - unique id of value to override
value - new value, or null to remove the key entirely

overrideInstance

public void overrideInstance(K key,
                             Class<? extends V> clazz)
Description copied from interface: MappedConfiguration
Overrides an existing contribution with a new instance. When the value type is an interface and the class to be contributed is a local file, then a reloadable proxy for the value class will be created and contributed.

Specified by:
overrideInstance in interface MappedConfiguration<K,V>
Parameters:
key - unique id of value to override
clazz - class to instantiate as override


Copyright © 2003-2012 The Apache Software Foundation.