Package org.apache.tapestry5.commons
Interface MappedConfiguration<K,V>
- All Known Implementing Classes:
ValidatingMappedConfigurationWrapper
public interface MappedConfiguration<K,V>
Object passed into a service contributor method that allows the method provide contributed values to the service's
configuration.
A service can collect contributions in three different ways:
- As an un-ordered collection of values
- As an ordered list of values (where each value has a unique id, pre-requisites and post-requisites)
- As a map of keys and values
-
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.
-
Method Details
-
add
Adds a keyed object to the service's contribution.- Parameters:
key
- unique id for the valuevalue
- to contribute- Throws:
IllegalArgumentException
- if key is not unique
-
override
Overrides an existing contribution by its key.- Parameters:
key
- unique id of value to overridevalue
- new value, or null to remove the key entirely- Since:
- 5.1.0.0
-
addInstance
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.- Parameters:
key
- unique id for the valueclazz
- class to instantiate and contribute- Since:
- 5.1.0.0
-
overrideInstance
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.- Parameters:
key
- unique id of value to overrideclazz
- class to instantiate as override
-