Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

property

declares a new property. The full form is like this. Name is the only required field:

Code Block
property name : "nameOfTask", type: String, declaringType: "java.lang.String", isStatic : false,
    isDeprecated: false, provider : "A readable name for your DSL",
    doc : "<b>Enter javadoc here</b> html is supported"

method

declares a new method. The full form is like this. Name is the only required field:

Code Block
linenumberstrue
languagegroovy
method name : "nameOfTask", type: String, declaringType: "java.lang.String",
    params : [ arg1 : String, arg2 : Class], 
    namedParams : [arg3 : Long, arg4 : Short],
    optionalParams: [arg5: Byte], isStatic : false,
    isDeprecated: false, // if true, then doc : any uses of this method will have a line through it
    noParens: false, // if true content assist will assume this is a groovy command chain expression and avoid using parens
    doc : "<b>Enter javadoc here</b> html isand javadoc tags supported",
    provider : "A readable name for your DSL"

A note on parameter kinds:

  • params : regular parameters are added via content assist on the method
  • namedParams : named parameters are added via content assist on the method prefixed by a name. And if content assist is invoked after a paren or a comma (with no text prefix), unused named parameters will be suggested.
  • optionalParams : optional parameters are only available when performing completion after a paren or comma (with no text prefix). They are not included during normal method content assist.
Parameter names may include whitespace and special characters as long as the parameter is quoted. For example, it is possible to simulate varargs like this:

 

Code Block
languagegroovy
method name : "meth", params : ["... values", String]

delegatesTo

adds all of the public methods in the delegated type to the current type. For example:

Code Block
delegatesTo List

will add all public methods of list to the current type for content assist, underlining, hovers, and navigation.

delegatesTo

(alternative form with named arguments) adds all of the public methods in the delegated type to the current type. There is a possibility to parameterize using named arguments:

  • type : (required) the type to delegate to.
  • asCategpry : (optional) if true, treat the delegated type as a category and only include static methods where the first parameter matches the type of the current type.
  • useNamed : (optional) if true, content assist will be applied using named arguments.
  • except : (optional) a list of method names to exclude from the delegation (useful if these methods are already being added through some other contribution).
  • isDeprecated : (optional) if true then this contribution is deprecated and all references to delegated methods will appear in the UI with a line through them.

...