Class ValidatingMappedConfigurationWrapper<K,V>
- java.lang.Object
-
- org.apache.tapestry5.ioc.internal.AbstractConfigurationImpl<V>
-
- org.apache.tapestry5.ioc.internal.ValidatingMappedConfigurationWrapper<K,V>
-
- Type Parameters:
K
- the key typeV
- the value type
- 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 theMappedConfiguration
interface, and provides two forms of validation for mapped configurations:- If either key or value is null, then a warning is logged
- If the key has previously been stored (by some other
ContributionDef
, then a warning is logged
-
-
Constructor Summary
Constructors Constructor Description ValidatingMappedConfigurationWrapper(java.lang.Class<V> expectedValueType, ObjectLocator locator, TypeCoercerProxy typeCoercer, java.util.Map<K,V> map, java.util.Map<K,MappedConfigurationOverride<K,V>> overrides, java.lang.String serviceId, ContributionDef contributionDef, java.lang.Class<K> expectedKeyType, java.util.Map<K,ContributionDef> keyToContributor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(K key, V value)
Adds a keyed object to the service's contribution.void
addInstance(K key, java.lang.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, java.lang.Class<? extends V> clazz)
Overrides an existing contribution with a new instance.-
Methods inherited from class org.apache.tapestry5.ioc.internal.AbstractConfigurationImpl
instantiate
-
-
-
-
Constructor Detail
-
ValidatingMappedConfigurationWrapper
public ValidatingMappedConfigurationWrapper(java.lang.Class<V> expectedValueType, ObjectLocator locator, TypeCoercerProxy typeCoercer, java.util.Map<K,V> map, java.util.Map<K,MappedConfigurationOverride<K,V>> overrides, java.lang.String serviceId, ContributionDef contributionDef, java.lang.Class<K> expectedKeyType, java.util.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 interfaceMappedConfiguration<K,V>
- Parameters:
key
- unique id for the valuevalue
- to contribute
-
addInstance
public void addInstance(K key, java.lang.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 interfaceMappedConfiguration<K,V>
- Parameters:
key
- unique id for the valueclazz
- 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 interfaceMappedConfiguration<K,V>
- Parameters:
key
- unique id of value to overridevalue
- new value, or null to remove the key entirely
-
overrideInstance
public void overrideInstance(K key, java.lang.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 interfaceMappedConfiguration<K,V>
- Parameters:
key
- unique id of value to overrideclazz
- class to instantiate as override
-
-