My favorites
▼
|
Sign in
rintcius
Miscellaneous code
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
rintcius.groovy
/
src
/
main
/
groovy
/
nl
/
rintcius
/
groovy
/
ExpandoBuilder.groovy
r3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package nl.rintcius.groovy
public class ExpandoBuilder extends BuilderSupport {
private static final String NAME_PROP = "name"
private static final String VALUE_PROP = "value"
public ExpandoBuilder() {
super()
setCurrent(new Expando())
}
protected void setParent(Object parent, Object child) {
String childName = child.getProperty(NAME_PROP)
parent.setProperty(childName, child)
}
protected Object createNode(Object name) {
createNode(name, null, null)
}
protected Object createNode(Object name, Object value) {
createNode(name, null, value)
}
protected Object createNode(Object name, Map attributes) {
createNode(name, attributes, null)
}
protected Object createNode(Object name, Map attributes, Object value) {
Expando e = new Expando()
e.setProperty(NAME_PROP, name)
e.setProperty(VALUE_PROP, value)
attributes.each() { k, v ->
e.setProperty(k,v)
}
return e
}
protected Object postNodeCompletion(Object parent, Object node) {
return parent
}
}
Show details
Hide details
Change log
r3
by rintcius on Sep 23, 2009
Diff
Initial version of ExpandoBuilder and ExpandoDsl
Go to:
/trunk/rintcius.groovy
/trunk/rintcius.groovy/.classpath
/trunk/rintcius.groovy/.project
/trunk/rintcius.groovy/.settings
...groovy.eclipse.preferences.prefs
...tings/org.eclipse.jdt.core.prefs
...ings/org.maven.ide.eclipse.prefs
/trunk/rintcius.groovy/pom.xml
/trunk/rintcius.groovy/src
/trunk/rintcius.groovy/src/main
.../rintcius.groovy/src/main/groovy
...ntcius.groovy/src/main/groovy/nl
...oovy/src/main/groovy/nl/rintcius
...c/main/groovy/nl/rintcius/groovy
...ius/groovy/ExpandoBuilder.groovy
...intcius/groovy/ExpandoDsl.groovy
/trunk/rintcius.groovy/src/test
.../rintcius.groovy/src/test/groovy
...ntcius.groovy/src/test/groovy/nl
...oovy/src/test/groovy/nl/rintcius
...c/test/groovy/nl/rintcius/groovy
...groovy/ExpandoBuilderTest.groovy
...ius/groovy/ExpandoDslTest.groovy
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1042 bytes, 43 lines
View raw file
Powered by
Google Project Hosting