Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

To create a new builder like a the MarkupBuilder or AntBuilder, you have to implement in java (in groovy later too) a subclass of the groovy.util.BuilderSupport class.
The main methods to be implemented are the following :

  • protected abstract void setParent(Object parent, Object child);
  • protected abstract Object createNode(Object name); // a node without parameter and closure
  • protected abstract Object createNode(Object name, Object value); //a node without parameters, but with closure
  • protected abstract Object createNode(Object name, Map attributes); // a Node without closure but with parameters
  • protected abstract Object createNode(Object name, Map attributes, Object value); //a node with closure and parameters
  • protected Object getName(String methodName)

The BuilderSupport.java class

...