Moti Asayag has uploaded a new change for review. Change subject: engine: Fix typos and suppress warnings in Injector ......................................................................
engine: Fix typos and suppress warnings in Injector Change-Id: I9893a8f525b458e3da33d2ba2431fffcb32dc3c3 Signed-off-by: Moti Asayag <masa...@redhat.com> --- M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/di/Injector.java 1 file changed, 7 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/90/38690/1 diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/di/Injector.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/di/Injector.java index 1f46333..fd02c7b 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/di/Injector.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/di/Injector.java @@ -9,7 +9,7 @@ import javax.inject.Singleton; /** - * an application wide interaction point with the CDI container mostly to gap all the existing unmanged code + * an application wide interaction point with the CDI container mostly to gap all the existing unmanaged code * or for unmanaged code which wants interaction with managed beans. * Typically this injector could be used anywhere to get a manage instance from instances which * aren't managed like some utility singletons etc @@ -35,6 +35,7 @@ * @param <T> an unmanaged CDI instance with some members containing <code>@Inject</code> annotated * members */ + @SuppressWarnings({ "unchecked", "rawtypes" }) public static <T> T injectMembers(T instance) { AnnotatedType type = injector.manager.createAnnotatedType(instance.getClass()); InjectionTarget injectionTarget = injector.manager.createInjectionTarget(type); @@ -47,11 +48,11 @@ * This method will fetch a managed CDI bean from the CDI container. * Using this method should help us bridge all places where we are in unmanaged instances * and we want an already managed instance. e.g all our Singletons getInstance methods are candidates for this usage, - * meaning we Make the Singleton a manged bean but let the existing code still + * meaning we Make the Singleton a managed bean but let the existing code still * get a reference by invoking getInstance which delegate to this method. * @param clazz the Runtime class representing the desired instance * @param <T> - * @return the instance of type <code><T></T></code> which is manged by the CDI container + * @return the instance of type <code><T></T></code> which is managed by the CDI container */ public static <T extends Object> T get(Class<T> clazz) { return injector.instanceOf(clazz); @@ -60,14 +61,15 @@ /** * convenience method, good for mocking and whoever holds a direct instance of Injector in hand.<br> * after all its a jdk "bug" to call a static method on an instance.<br> - *{@link Injector#get(Class)} should supply the same behaiour exactly + *{@link Injector#get(Class)} should supply the same behavior exactly * @param clazz * @param <T> * @return instance of T * @see #get(Class) */ + @SuppressWarnings("unchecked") public <T extends Object> T instanceOf(Class<T> clazz) { - Bean bean = injector.manager.getBeans(clazz).iterator().next(); + Bean<?> bean = injector.manager.getBeans(clazz).iterator().next(); return (T) injector.manager.getReference(bean, clazz, injector.manager.createCreationalContext(bean)); } } -- To view, visit https://gerrit.ovirt.org/38690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9893a8f525b458e3da33d2ba2431fffcb32dc3c3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <masa...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches