Created
June 8, 2011 07:49
-
-
Save mathieuancelin/1013991 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
private InjectionTarget it; | |
private AnnotatedType annotated; | |
private BeanManager beanManager; | |
public <T> T create(CreationalContext<T> creationalContext) { | |
annotated = beanManager.createAnnotatedType(myType); | |
it = manager.createInjectionTarget(annotated); | |
T instance = (T) it.produce(creationalContext); | |
it.inject(instance, creationalContext); | |
it.postConstruct(instance); | |
return instance; | |
} | |
public <T> void destroy(T instance, CreationalContext<T> creationalContext) { | |
it.preDestroy(instance); | |
it.dispose(instance); | |
creationalContext.dispose(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment