|
J avolution v5.3 (J2SE 1.5+) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavolution.lang.Configurable.Logic
public abstract static class Configurable.Logic
This class represents a configuration logic capable of setting
Configurable
values. For example:
Applications can prevent further configuration modifications using
class MyApplication {
private static final Configuration CONFIGURATION = new Configuration();
public static void main(String[] args) {
CONFIGURATION.run();
...
}
static class Configuration extends Configurable.Logic implements Runnable {
public void run() {
Properties properties = System.getProperties();
// Properties could be loaded automatically if the property names
// were the full names of the configurable fields (ref. Configurable.read(Map)).
String concurrency = properties.get("MAXIMUM_CONCURRENCY");
if (concurrency != null) {
configure(ConcurrentContext.MAXIMUM_CONCURRENCY, TypeFormat.parseInt(concurrency));
}
...
}
}
}
Configurable.setUnmodifiable()
or custom SecurityContext
.
For example:
public class MyPolicy extends SecurityContext {
public boolean isModifiable (Configurable cfg) {
return false;
}
}
...
configure(SecurityContext.DEFAULT, MyPolicy.class); // Global setting.
Constructor Summary | |
---|---|
Configurable.Logic()
|
Method Summary | ||
---|---|---|
protected
|
configure(Configurable<T> cfg,
T value)
Sets the run-time value of the specified configurable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Configurable.Logic()
Method Detail |
---|
protected final <T> void configure(Configurable<T> cfg, T value)
Configurable.notifyChange()
is called. This method
raises SecurityException
if the specified
configurable is not modifiable
.
cfg
- the configurable being configurated.value
- the new run-time value.
java.lang.SecurityException
- if the specified configurable cannot
be modified.
|
J avolution v5.3 (J2SE 1.5+) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |