Writing my first ScriptedLookupService in groovy, and I think I have a pretty 
simple question:
I'd like to be able to return multiple values in one lookup, but I can't figure 
out what my return type needs to be.
String isn't right, obviously, and returning a Map<Object, String> isn't right.
Is lookup only able to handle one value? Seems like you should be able to look 
up multiple values.

class MyValueLookupService implements LookupService<String> {
    ComponentLog log = null
    final String ID = UUID.randomUUID().toString()
    @Override
    Optional<Object> lookup(Map<String,String> lookupMap) { //<---- wrong 
return type
        // this is wrong
        
Optional.ofNullable(slurper.parseText("{\"key1\":\"value1\",\"key2\":\"value2\"}"))
    }

    @Override
    Class<?> getValueType() {
        // This is wrong too
        return Object
    }
... other stuff
}
lookupService = new MyLookupService()

Thanks

Geoffrey Greene

Reply via email to