Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.3 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javolution.lang
Class Configurable.Logic

    java.lang.Object
      javolution.lang.Configurable.Logic

Enclosing class:
  Configurable<T>

    public abstract static class Configurable.Logic

extends java.lang.Object

This class represents a configuration logic capable of setting `Configurable` values. For example:``

     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));
                 }
                 ...
             }
        }
     }

Applications can prevent further configuration modifications using `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
`<T> void`
` | `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

### Configurable.Logic

    public Configurable.Logic()

Method Detail

### configure

    protected final <T> void configure(Configurable<T> cfg,
                                       T value)

  Sets the run-time value of the specified configurable. If configurable value is different from the previous one, then `Configurable.notifyChange()` is called. This method raises `SecurityException` if the specified configurable is not `modifiable`.

  Parameters:
    `cfg` - the configurable being configurated.
    `value` - the new run-time value.
  Throws:
    `java.lang.SecurityException` - if the specified configurable cannot be modified.

Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.3 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 - 2009 Javolution.