git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(no commit message)
[utils]
/
support
/
cdi
/
src
/
main
/
java
/
org
/
wamblee
/
cdi
/
CdiInjectorFactory.java
diff --git
a/support/cdi/src/main/java/org/wamblee/cdi/CdiInjectorFactory.java
b/support/cdi/src/main/java/org/wamblee/cdi/CdiInjectorFactory.java
index 2237648b0b5b58f91521976886558970eec643a5..a4e575aa7f8b7bee581808a737948df1dc6e7d6b 100644
(file)
--- a/
support/cdi/src/main/java/org/wamblee/cdi/CdiInjectorFactory.java
+++ b/
support/cdi/src/main/java/org/wamblee/cdi/CdiInjectorFactory.java
@@
-23,9
+23,8
@@
import org.wamblee.inject.Injector;
import org.wamblee.inject.InjectorFactory;
/**
import org.wamblee.inject.InjectorFactory;
/**
- * Factory that creates CDI injectors. In case no beanmanager is found then
- * injectors will do nothing. This class may be subclassed for testing to
- * override the injectors that are returned.
+ * Factory that creates CDI injectors. This class may be subclassed for testing
+ * to override the injectors that are returned.
*
* @author Erik Brakkee
*/
*
* @author Erik Brakkee
*/
@@
-37,7
+36,10
@@
public class CdiInjectorFactory implements InjectorFactory {
private BeanManager beanManager;
/**
private BeanManager beanManager;
/**
- * Constructs the factory using the default bean manager.
+ * Constructs the factory using a default bean manager.
+ *
+ * @throws IllegalArgumentException
+ * If bean manager is null.
*/
public CdiInjectorFactory() {
this(BeanManagerLookup.lookup());
*/
public CdiInjectorFactory() {
this(BeanManagerLookup.lookup());
@@
-47,22
+49,18
@@
public class CdiInjectorFactory implements InjectorFactory {
* Constructs the factory using an explicit bean manager.
*
* @param aBeanManager
* Constructs the factory using an explicit bean manager.
*
* @param aBeanManager
+ * @throws IllegalArgumentException
+ * If bean manager is null.
*/
public CdiInjectorFactory(BeanManager aBeanManager) {
*/
public CdiInjectorFactory(BeanManager aBeanManager) {
+ if (aBeanManager == null) {
+ throw new IllegalArgumentException("Bean manager is null");
+ }
beanManager = aBeanManager;
}
@Override
public Injector create(Class aClass) {
beanManager = aBeanManager;
}
@Override
public Injector create(Class aClass) {
- if (beanManager == null) {
- // Typically for unit test.
- return new Injector() {
- @Override
- public void inject(Object aComponent) {
- // Empty.
- }
- };
- }
return new CdiInjector(beanManager, aClass);
}
return new CdiInjector(beanManager, aClass);
}