RetrieveCompiledRulesSourceCode

    Sometimes it's very helpful to be able to have a look into the compiled Rules Java Code.

     

    Here's the way you could do it:

     

    -- create a Packagebuilder and build package (described in severeal tutorials)

     

    JavaDialect jd = (JavaDialect) builder.getDialectRegistry().getDialect("java");

     

     

    Field field = jd.getClass().getDeclaredField("src");

     

    field.setAccessible(true);

     

     

    MemoryResourceReader src = (MemoryResourceReader) field.get(jd);

     

     

    String{FOOTNOTE DEF  } list = src.list();

     

    for (int z = 0; z < list.length; z++)

     

    {

     

          String name = (String) list[Z|z];

     

          byte{FOOTNOTE DEF  } bytes = src.getBytes( name );

     

     

          // Retrieve each rule in the package

     

          System.out.println(new String(bytes));

     

    }

     

     

     

    -