In general, using typed objects is the preferred way to go, so I think a
configuration object should be a type object and return configuration
values in the correct type. Let's not fall back into the 80s and fiddle
around with string conversions all over the place.
Having a type for a configuration removes also the need for those ugly
name constants and we could hopefully also get away with having ugly
constants for default values.

So what about using the approach we use in the new Declarative Service
specification and you define a configuration as an annotation:

public @interface MyConfiguration {

   int port() default 465;

   String host() default "localhost";

   String userId;
}

This leaves us with a single place to define a type configuration object
in combination with default values. We then define simple mapping rules
from names to resource names.

And we should also support *all* java types not just those JCR supports.
Internally all numbers can be stored as long but the configuration
object gives you an integer, char whatever.

This is how I would like to deal with configurations in code.

Carsten

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziege...@apache.org

Reply via email to