org.jvnet.hk2.config
Interface SingleConfigCode<T extends ConfigBeanProxy>
public interface SingleConfigCode<T extends ConfigBeanProxy>
SimpleConfigCode is code snippet that can be used to apply some configuration
changes to one configuration object.
For example say, you need to modify the HttpListener config object with a new
port number, you can do so by writing the following code snippet.
new SingleConfigCode<HttpListener>() {
public boolean run(HttpListener httpListener) throws PropertyVetoException {
httpListener.setPort("8989");
return true;
}
};
This new SingleConfigCode can then be used with in the ConfigSupport utilities to
run this code within a Transaction freeing the developer to know/care about Transaction
APIs and semantics.
- Author:
- Jerome Dochez
Method Summary |
Object |
run(T param)
Runs the following command passing the configration object. |
run
Object run(T param)
throws PropertyVetoException,
TransactionFailure
- Runs the following command passing the configration object. The code will be run
within a transaction, returning true will commit the transaction, false will abort
it.
- Parameters:
param
- is the configuration object protected by the transaction
- Returns:
- any object that should be returned from within the transaction code
- Throws:
PropertyVetoException
- if the changes cannot be applied
to the configuration
TransactionFailure
Copyright © 2013 Oracle Corporation. All Rights Reserved.