Skip to content

Instantly share code, notes, and snippets.

View ngandriau's full-sized avatar
💭
back to git

Nicolas GANDRIAU ngandriau

💭
back to git
View GitHub Profile
@ngandriau
ngandriau / documentation of groovy method with map a property
Created January 6, 2013 15:47
Looking for the best way to document groovy methods with a map as parameter.
/**
* Method with a Map as parameter
*
* @param properties Map for the parameters of the method. Supported key: <br/>
* - param1: String, mandatory<br/>
* - param2: boolean. Optional(default= true)<br/>
* - param3: String (any value), Optional(default="Def param3")<br/>
* @return
*/
def maMethod(Map properties) {
@ngandriau
ngandriau / Sandbox.groovy
Created July 6, 2013 17:34
surprise when using string variable/constant as Map's key
// Illustration of a side effect when using string variable/constant for map's key
def PROP_NAME = "property name"
def myMap = [PROP_NAME: "a Value"]
//assert myMap.keySet().iterator().next() == "property name"
// fails at runtime but it compiles.
// I was expecting the value of the variable to be the key, but it is in fact a String with the name of the variable
@ngandriau
ngandriau / TestLogASTAnnotation.groovy
Created July 6, 2013 22:12
Sample of failure when calling the LOG generated by the @slf4j annotation.
import groovy.util.logging.Slf4j
/**
* Created by User: ngandriau - Date: 7/6/13 - Time: 5:52 PM
*/
@Slf4j(value = "LOG")
class TestLogASTAnnotation {
static TestLogASTAnnotation staticInstanceOfMyClass = new TestLogASTAnnotation()
@ngandriau
ngandriau / ActivitiMonitor.groovy
Created September 25, 2013 17:11
activiti secure rest call attempt
package com.hybris.activity
import groovyx.net.http.ContentType
import groovyx.net.http.RESTClient
/**
* Created by User: ngandriau - Date: 9/25/13 - Time: 12:07 PM
*
* this works: curl --basic --user kermit:kermit http://localhost:8080/activiti-rest/service/process-engine
*/