Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Dashboard
Groovy
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h1>Hierarchy</h1> <ul> <li>Object <ul> <li>GroovyObjectSupport <ul> <li>Binding <ul> <li>FactoryBuilderSupport <ul> <li>griffon.builder.UberBuilder <ul> <li>griffon.gui.GUIBuilder</li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> <p>The logic to support all of the non-specific builder magic will go into UberBuilder. GUIBuilder will be an instance if UberBuilder with specific factories pre-loaded into the cache.</p> <h1>Constructor</h1> <p>The only constructor will be </p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>UberBuilder(Object[] builders) { builders.each {if (it) uberInit(it)} }</pre></td></tr></table> <p> This is driven by the use case. Each uberInit method will exploit the dynamic dispatch mechanism of Groovy to match to the proper uberInit method.</p> <p>Consider the following calls</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>UberBuilder('ant', 'swing', 'DOM') UberBuilder(AntBuilder, SwingBuilder, DOMBuilder) UberBuilder(new AntBuilder(), new SwingBuilder(), new DOMBuilder()</pre></td></tr></table> <p>All three of these would create an UberBuilder with ant, swing, and dom factories pre-loaded. Other factories may be addable if the child instance exposes the factory registration methods publicly. (some UberBuilders may not want to). </p> <p>First, there will be an internal registry mapping, mapping some object (usually strings) to the relevant registrations for the UberBuilder. Hence the fallback case:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>public final uberInit(Object builderKey) { def builder = buildersRegistry[builderKey] // make sure we won't self-loop if (builder?.metaClass?.respondsTo(builder, 'uberInit', builder.class)?.size() > 1) { // if we get more than one, we have more than this base case, so look it up return uberInit(buidler) } }</pre></td></tr></table> <p> We basically try to init again if we don't get a match, except we look at the internal registry cache to 'de-reference' the symbol. Usually a String, but there may be instances where we may want to intercept a class. (should we move the dereferencing to the constructor?)</p> <h3>String</h3> <p>This is always a de-reference. We may not even need an uberInit method, except for clarity.</p> <h3>Class</h3> <p>If the class is assignable to FactoryBuilderSupport, we attempt to no-args construct it. If we are successful we feed it to uberInit(FactoryBuilderSupport), if not we feed it to uberInit(Object) before failing.</p> <h3>FactoryBuilderSupport</h3> <p>There are two approaches we can use here, not sure which is best.</p> <ol> <li>We can wrap the builder's nodes using withBuilder and re-direct them into the proxy</li> <li>We can take all of the registered factories and stuff them into this UberBuilder.</li> </ol> <h3>Map</h3> <p>Maps will be handled based on the type of the value argument. We may even want to allow 'unwrapped' calls via type tricks, ie </p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>uberBuilder(J: SwingBuilder, SwingXBuilder, Ant:AntBuilder, '<':DOMBuilder)</pre></td></tr></table> <h4>Factory value</h4> <p>The key will be registered as a node name and the factory will be the value</p> <h4>FactoryBuilderSupport</h4> <p>The key will be a prefix to each of the nodes and it will be otherwise treated as a call with just the FactoryBuilderSupport.</p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced