diff --git a/build.gradle b/build.gradle
index aa75168..a20ca5f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -130,7 +130,8 @@ sourceSets {
"org/codehaus/groovy/tools/shell/**/*.xml",
"org/codehaus/groovy/antlib.xml",
"org/codehaus/groovy/tools/groovydoc/gstringTemplates/**/*.*",
- "org/codehaus/groovy/tools/groovy.ico"
+ "org/codehaus/groovy/tools/groovy.ico",
+ "gdsl/*.gdsl"
}
classesDir = "$buildDir/classes" as File
}
diff --git a/build.xml b/build.xml
index fd6217d..d27b831 100644
--- a/build.xml
+++ b/build.xml
@@ -482,6 +482,7 @@ $Date$
+
diff --git a/src/main/gdsl/autoexternalize.gdsl b/src/main/gdsl/autoexternalize.gdsl
new file mode 100644
index 0000000..b0a1fe3
--- /dev/null
+++ b/src/main/gdsl/autoexternalize.gdsl
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Johannes Bueller
+ * @author Sibylle Peter
+ * @author Andres Almiray
+ */
+
+contributor(scope: annotatedScope(ctype: 'groovy.transform.AutoExternalize')) {
+ delegatesTo(findClass('java.io.Externalizable'))
+}
\ No newline at end of file
diff --git a/src/main/gdsl/bindable.gdsl b/src/main/gdsl/bindable.gdsl
new file mode 100644
index 0000000..8d0bb50
--- /dev/null
+++ b/src/main/gdsl/bindable.gdsl
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Andres Almiray
+ */
+
+def addBindableSupport = { on ->
+ on.with {
+ method name: 'addPropertyChangeListener', type: 'void', params: [listener: 'java.beans.PropertyChangeListener']
+ method name: 'addPropertyChangeListener', type: 'void', params: [name: 'java.lang.String', listener: 'java.beans.PropertyChangeListener']
+ method name: 'removePropertyChangeListener', type: 'void', params: [listener: 'java.beans.PropertyChangeListener']
+ method name: 'removePropertyChangeListener', type: 'void', params: [name: 'java.lang.String', listener: 'java.beans.PropertyChangeListener']
+ method name: 'getPropertyChangeListeners', type: 'java.beans.PropertyChangeListener[]'
+ method name: 'getPropertyChangeListeners', type: 'java.beans.PropertyChangeListener[]', params: [name: 'java.lang.String']
+ }
+}
+
+contributor(scope: annotatedScope(ctype: 'groovy.beans.Bindable')) {
+ addBindableSupport delegate
+}
+
+contributor(ctype: hasField(hasAnnotation('groovy.beans.Bindable'))) {
+ addBindableSupport delegate
+}
\ No newline at end of file
diff --git a/src/main/gdsl/delegate.gdsl b/src/main/gdsl/delegate.gdsl
new file mode 100644
index 0000000..cbab5bb
--- /dev/null
+++ b/src/main/gdsl/delegate.gdsl
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Andres Almiray
+ */
+
+contributor(ctype: hasField(hasAnnotation("groovy.lang.Delegate"))) {
+ for (field in psiClass?.fields?.grep {it.hasAnnotation("groovy.lang.Delegate")}) {
+ delegateTo field.type.className
+ }
+}
\ No newline at end of file
diff --git a/src/main/gdsl/indexed_property.gdsl b/src/main/gdsl/indexed_property.gdsl
new file mode 100644
index 0000000..b6f2308
--- /dev/null
+++ b/src/main/gdsl/indexed_property.gdsl
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.intellij.psi.PsiArrayType
+
+/**
+ * @author Johannes Bueller
+ * @author Sibylle Peter
+ * @author Andres Almiray
+ */
+
+contributor(ctype: hasField(hasAnnotation("groovy.transform.IndexedProperty"))) {
+ for (field in psiClass?.fields?.grep {it.hasAnnotation("groovy.transform.IndexedProperty")}) {
+ String propertyName = field.name
+ def psiElementType = field.type
+ String type = 'java.lang.Object'
+ if (psiElementType instanceof PsiArrayType) {
+ type = psiElementType.componentType.className
+ } else {
+ type = field.type.parameters ? field.type.parameters[0].className : 'java.lang.Object'
+ }
+ propertyName = propertyName.size() == 1 ? propertyName.toUpperCase() : propertyName[0].toUpperCase() + propertyName[1..-1]
+ method name: 'get' + propertyName, type: type, params: [index: 'int']
+ method name: 'set' + propertyName, type: 'void', params: [index: 'int', element: type]
+ }
+}
\ No newline at end of file
diff --git a/src/main/gdsl/listenerlist.gdsl b/src/main/gdsl/listenerlist.gdsl
new file mode 100644
index 0000000..d98648b
--- /dev/null
+++ b/src/main/gdsl/listenerlist.gdsl
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.intellij.psi.PsiType
+import com.intellij.psi.PsiField
+import com.intellij.psi.PsiClass
+import com.intellij.psi.PsiMethod
+import com.intellij.psi.PsiParameter
+
+/**
+ * @author Ryan Applegate
+ * @author Andres Almiray
+ */
+
+contributor(ctype: hasField(hasAnnotation("groovy.beans.ListenerList"))) {
+ for (PsiField field : psiClass?.fields?.grep {it.hasAnnotation("groovy.beans.ListenerList")}) {
+
+ def type = field.type.parameters ? field.type.parameters[0] : null
+ if(!type) return
+ String typeClassName = type.className
+ method name: 'add' + typeClassName, type: void, params: [listener: typeClassName]
+ method name: 'remove' + typeClassName, type: void, params: [listener: typeClassName]
+ method name: 'get' + typeClassName + 's', type: typeClassName + '[]'
+
+ for(PsiMethod m : findClass(type.getDeepComponentType().canonicalText).getMethods()) {
+ String methodName = m.getName()
+ methodName = methodName[0].toUpperCase() + methodName[1..-1]
+ Map params = [:]
+ for(PsiParameter param : m.parameterList.parameters) {
+ String paramName = param.typeElement.text
+ paramName = paramName[0].toLowerCase() + paramName[1..-1]
+ params[paramName] = param.type.getDeepComponentType().canonicalText
+ }
+
+ method name: 'fire' + methodName, type: 'void', params: params
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/gdsl/singleton.gdsl b/src/main/gdsl/singleton.gdsl
new file mode 100644
index 0000000..c836366
--- /dev/null
+++ b/src/main/gdsl/singleton.gdsl
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Andres Almiray
+ */
+
+contributor(scope: annotatedScope(ctype: 'groovy.lang.Singleton')) {
+ method name: 'getInstance', params: [name: 'java.lang.String'], type: enclosingClass().qualName, 'isStatic': true
+}
\ No newline at end of file
diff --git a/src/main/gdsl/vetoable.gdsl b/src/main/gdsl/vetoable.gdsl
new file mode 100644
index 0000000..1de7851
--- /dev/null
+++ b/src/main/gdsl/vetoable.gdsl
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Andres Almiray
+ */
+
+def addVetoableSupport = { on ->
+ on.with {
+ method name: 'addVetoableChangeListener', type: 'void', params: [listener: 'java.beans.VetoableChangeListener']
+ method name: 'addVetoableChangeListener', type: 'void', params: [name: 'java.lang.String', listener: 'java.beans.VetoableChangeListener']
+ method name: 'removeVetoableChangeListener', type: 'void', params: [listener: 'java.beans.VetoableChangeListener']
+ method name: 'removeVetoableChangeListener', type: 'void', params: [name: 'java.lang.String', listener: 'java.beans.VetoableChangeListener']
+ method name: 'getVetoableChangeListeners', type: 'java.beans.VetoableChangeListener[]'
+ method name: 'getVetoableChangeListeners', type: 'java.beans.VetoableChangeListener[]', params: [name: 'java.lang.String']
+ }
+}
+
+contributor(scope: annotatedScope(ctype: 'groovy.beans.Vetoable')) {
+ addVetoableSupport delegate
+}
+
+contributor(ctype: hasField(hasAnnotation('groovy.beans.Vetoable'))) {
+ addVetoableSupport delegate
+}