org.apache.tapestry5.ioc
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:

The service defines the type of contribution, in terms of a base class or service interface. Contributions must be compatible with the type.


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.
 

Method Detail

add

void add(K key,
         V value)
Adds a keyed object to the service's contribution.

Parameters:
key - unique id for the value
value - to contribute
Throws:
IllegalArgumentException - if key is not unique

override

void override(K key,
              V value)
Overrides an existing contribution by its key.

Parameters:
key - unique id of value to override
value - new value, or null to remove the key entirely
Since:
5.1.0.0

addInstance

void addInstance(K key,
                 Class<? extends V> clazz)
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 value
clazz - class to instantiate and contribute
Since:
5.1.0.0

overrideInstance

void overrideInstance(K key,
                      Class<? extends V> clazz)
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 override
clazz - class to instantiate as override


Copyright © 2003-2012 The Apache Software Foundation.