Created
July 30, 2010 17:14
-
-
Save spullara/500924 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public static class ClassToTypeLiteralMatcherAdapter extends AbstractMatcher<TypeLiteral> { | |
| private final Matcher<Class> classMatcher; | |
| public ClassToTypeLiteralMatcherAdapter(Matcher<Class> classMatcher) { | |
| this.classMatcher = classMatcher; | |
| } | |
| public boolean matches(TypeLiteral typeLiteral) { | |
| return classMatcher.matches(typeLiteral.getRawType()); | |
| } | |
| } | |
| // Initialize CodeBehindHandlers | |
| bindListener(new ClassToTypeLiteralMatcherAdapter(Matchers.subclassesOf(CodebehindHandler.class)), | |
| new TypeListener() { | |
| @Override | |
| public <I> void hear(TypeLiteral<I> iTypeLiteral, TypeEncounter<I> iTypeEncounter) { | |
| iTypeEncounter.register(new InjectionListener<I>() { | |
| @Override | |
| public void afterInjection(Object o) { | |
| CodebehindHandler ch = (CodebehindHandler) o; | |
| ch.getCode(); | |
| } | |
| }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment