From documentation, I found how to do service-device mappings using java with a @ServiceCallback method. It works by instantiating templates from the service context like so: @ServiceCallback(...)
public Properties create(ServiceContext context, ...)...