Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-395

groovy for interpolation and expression engine

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • 2.x
    • None

    Description

      Currently the expression engine can be set but not the interpolation.
      This patch proposes the ability to set a user specified interpolation engine.
      It includes a groovy interpolation engine. Groovy comes naturally as an expressions and interpolation language in the java environment

      API usage:

      AbstractConfiguration c = new PropertiesConfiguration("conf/test.conf");
      c.setInterpolator(new GInterpolator(c));
      System.out.println(c.getString("test"));

      Configuration examples:

      library.path.1=${ if ("${System.getProperty

      {('os.name')}

      ".toLowerCase().startsWith("windows")) "libw.dll"; else "libl" }
      password=${println 'enter password'; readln}

      I think that this is more feature rich than JEXL and is easier to use for java programmers.

      • Ron

      Attachments

        1. AbstractConfiguration.patch
          2 kB
          ron
        2. ConfigurationBinding.java
          0.6 kB
          ron
        3. GInterpolator.java
          2 kB
          ron
        4. Interpolator.java
          0.1 kB
          ron

        Activity

          People

            Unassigned Unassigned
            rzorzorzo ron
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: