-
-
Save mren/552efc20093d270e3c31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jboss.errai.bus.client.api.ResourceProvider; | |
import org.jboss.errai.bus.server.api.ErraiConfig; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
public class Binder<E> { | |
private final Logger logger = LoggerFactory.getLogger(Binder.class); | |
private final ErraiConfig config; | |
private final E subject; | |
private final Class clazz; | |
public Binder(ErraiConfig config, E subject, Class clazz) { | |
this.config = config; | |
this.subject = subject; | |
this.clazz = clazz; | |
} | |
public void bind() { | |
ResourceProvider<E> adapter = new ResourceProvider<E>() { | |
public E get() { | |
return subject; | |
} | |
}; | |
logger.info("adding binding for: " + subject.getClass()); | |
config.addBinding(clazz, adapter); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment