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 the
MappedConfiguration
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
ConstructorsConstructorDescriptionValidatingMappedConfigurationWrapper
(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
Modifier and TypeMethodDescriptionvoid
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
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
-
Constructor Details
-
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 Details
-
add
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
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
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
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
-