Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration

[configuration] Enhancement of interpolation features

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4
    • Component/s: None
    • Labels:
    • Environment:

      Operating System: other
      Platform: Other

    • Bugzilla Id:


      At the moment interpolation is only supported by the getString() and
      getStringArray() methods. This proposal suggests adding interpolation support
      for other getter methods, too, and at the same time making it more customizable
      (including the ability to disable it at all).

      A first step in achieving this could be to refactor the interpolation
      functionality out of AbstractConfiguration and into a new Interpolator class.
      This class would provide a main interpolation method and would also maintain an
      arbitrary number of objects that know how to resolve variables of certain types.
      Each Configuration object would be assigned an Interpolator instance, to which
      it would delegate interpolation tasks.

      Customization of the interpolation features could be done by assigning an
      Interpolator object to a configuration that has been initialized with a custom
      set of variable resolver objects. If no Interpolator is assigned, no
      interpolation will be performed.

      Variable resolver objects are very simple: They define a method which takes a
      variable's name and return its value. The variable resolver to use for a
      concrete variable is determined by a prefix that can be set for each variable.
      So a variable like ${sys:user.home} e.g. might refer to the system properties
      resolver. Variables without a prefix are handled by a default resolver, which is
      implemented by the Configuration object itself, so that the Configuration's
      properties are used as variable values (which is backwards compatible to the
      current functionality).

      It should be possible to define a default Interpolator (or at least a default
      set of variable resolvers) that is to be used by each Configuration object as
      long as no special Interpolator is set. This could be done through a static
      field in AbstractConfiguration.

      Useful specific variable resolver classes could be:

      • The already mentioned system properties resolver, which would make system
        properties accessable in each configuration.
      • A resolver that would read constant values from specified classes.
      • A resolver that would evaluate expressions in an expression language like EL.


        Issue Links



            • Assignee:
              oheger Oliver Heger
              oheger Oliver Heger


              • Created:

                Issue deployment