1 Reply Latest reply on Jun 3, 2011 8:02 AM by tfennelly

    Smooks and Groovy import question

    bglasco1

      The documentation states:

      Add imports using the appropriately-named imports element. A number of classes are automatically imported.

       

       

      I need to access groovy.time.* package in smooks is there a way to import it? Or do I need to do a resource groovy class?

        • 1. Re: Smooks and Groovy import question
          tfennelly

          Do you have schema based auto-completion in your IDE?  Look at the schema for the groovy scripting extension and you'll see that it supports an <imports> element into which you drop the imports (just like in a java class): http://www.milyn.org/xsd/smooks/groovy-1.1.xsd

           

          Example...

           

          <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" 
                                xmlns:g="http://www.milyn.org/xsd/smooks/groovy-1.1.xsd">
          
              <g:groovy executeOnElement="category">
                  <g:imports>
                      import com.acme.blah.Blah;
                      import groovy.time.*;
                  </g:imports>
                  <g:script>
                      <!--
                      // Groovy scriptlet goes here...
                      -->
                  </g:script>
              </g:groovy>
          
          </smooks-resource-list>