You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by sb...@apache.org on 2012/02/22 23:32:56 UTC
[2/2] git commit: DELTASPIKE-69 fixed
DELTASPIKE-69 fixed
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/e5166790
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/e5166790
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/e5166790
Branch: refs/heads/master
Commit: e51667902c52ec60043fd92310adcab465c53964
Parents: 1177d4a
Author: gpetracek <gp...@apache.org>
Authored: Wed Feb 22 07:02:41 2012 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Wed Feb 22 07:02:41 2012 +0100
----------------------------------------------------------------------
.../metadata/builder/ImmutableInjectionPoint.java | 78 +++++++---
.../api/metadata/builder/InjectableMethod.java | 57 +++++--
.../metadata/builder/ParameterValueRedefiner.java | 56 +++++--
.../org/apache/deltaspike/core/util/Beans.java | 122 +++++++++++----
4 files changed, 229 insertions(+), 84 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/e5166790/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/ImmutableInjectionPoint.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/ImmutableInjectionPoint.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/ImmutableInjectionPoint.java
index 9d5180e..5da00cf 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/ImmutableInjectionPoint.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/ImmutableInjectionPoint.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.deltaspike.core.api.metadata.builder;
import java.lang.annotation.Annotation;
@@ -26,14 +44,15 @@ import static java.util.Collections.unmodifiableSet;
* @author Stuart Douglas
* @author Pete Muir
*/
-public class ImmutableInjectionPoint implements InjectionPoint {
+public class ImmutableInjectionPoint implements InjectionPoint
+{
private final Annotated annotated;
private final Member member;
private final Bean<?> declaringBean;
private final Set<Annotation> qualifiers;
private final Type type;
- private final boolean _transient;
+ private final boolean isTransient;
private final boolean delegate;
/**
@@ -43,16 +62,18 @@ public class ImmutableInjectionPoint implements InjectionPoint {
* @param field the field for which to create the injection point
* @param qualifiers the qualifiers on the injection point
* @param declaringBean the declaringBean declaring the injection point
- * @param _transient <code>true</code> if the injection point is transient
+ * @param isTransient <code>true</code> if the injection point is transient
* @param delegate <code>true</code> if the injection point is a delegate
* injection point on a decorator
*/
- public ImmutableInjectionPoint(AnnotatedField<?> field, Set<Annotation> qualifiers, Bean<?> declaringBean, boolean _transient, boolean delegate) {
+ public ImmutableInjectionPoint(AnnotatedField<?> field, Set<Annotation> qualifiers, Bean<?> declaringBean,
+ boolean isTransient, boolean delegate)
+ {
this.annotated = field;
this.member = field.getJavaMember();
this.qualifiers = new HashSet<Annotation>(qualifiers);
this.type = field.getJavaMember().getGenericType();
- this._transient = _transient;
+ this.isTransient = isTransient;
this.delegate = delegate;
this.declaringBean = declaringBean;
}
@@ -64,16 +85,18 @@ public class ImmutableInjectionPoint implements InjectionPoint {
*
* @param field the field for which to create the injection point
* @param declaringBean the declaringBean declaring the injection point
- * @param _transient <code>true</code> if the injection point is transient
+ * @param isTransient <code>true</code> if the injection point is transient
* @param delegate <code>true</code> if the injection point is a delegate
* injection point on a decorator
*/
- public ImmutableInjectionPoint(AnnotatedField<?> field, BeanManager beanManager, Bean<?> declaringBean, boolean _transient, boolean delegate) {
+ public ImmutableInjectionPoint(AnnotatedField<?> field, BeanManager beanManager, Bean<?> declaringBean,
+ boolean isTransient, boolean delegate)
+ {
this.annotated = field;
this.member = field.getJavaMember();
this.qualifiers = Beans.getQualifiers(beanManager, field.getAnnotations());
this.type = field.getJavaMember().getGenericType();
- this._transient = _transient;
+ this.isTransient = isTransient;
this.delegate = delegate;
this.declaringBean = declaringBean;
}
@@ -85,15 +108,17 @@ public class ImmutableInjectionPoint implements InjectionPoint {
* @param parameter the parameter for which to create the injection point
* @param qualifiers the qualifiers on the injection point
* @param declaringBean the declaringBean declaring the injection point
- * @param _transient <code>true</code> if the injection point is transient
+ * @param isTransient <code>true</code> if the injection point is transient
* @param delegate <code>true</code> if the injection point is a delegate
* injection point on a decorator
*/
- public ImmutableInjectionPoint(AnnotatedParameter<?> parameter, Set<Annotation> qualifiers, Bean<?> declaringBean, boolean _transient, boolean delegate) {
+ public ImmutableInjectionPoint(AnnotatedParameter<?> parameter, Set<Annotation> qualifiers, Bean<?> declaringBean,
+ boolean isTransient, boolean delegate)
+ {
this.annotated = parameter;
this.member = parameter.getDeclaringCallable().getJavaMember();
this.qualifiers = new HashSet<Annotation>(qualifiers);
- this._transient = _transient;
+ this.isTransient = isTransient;
this.delegate = delegate;
this.declaringBean = declaringBean;
this.type = parameter.getBaseType();
@@ -106,46 +131,55 @@ public class ImmutableInjectionPoint implements InjectionPoint {
*
* @param parameter the parameter for which to create the injection point
* @param declaringBean the declaringBean declaring the injection point
- * @param _transient <code>true</code> if the injection point is transient
+ * @param isTransient <code>true</code> if the injection point is transient
* @param delegate <code>true</code> if the injection point is a delegate
* injection point on a decorator
*/
- public ImmutableInjectionPoint(AnnotatedParameter<?> parameter, BeanManager beanManager, Bean<?> declaringBean, boolean _transient, boolean delegate) {
+ public ImmutableInjectionPoint(AnnotatedParameter<?> parameter, BeanManager beanManager, Bean<?> declaringBean,
+ boolean isTransient, boolean delegate)
+ {
this.annotated = parameter;
this.member = parameter.getDeclaringCallable().getJavaMember();
this.qualifiers = Beans.getQualifiers(beanManager, parameter.getAnnotations());
- this._transient = _transient;
+ this.isTransient = isTransient;
this.delegate = delegate;
this.declaringBean = declaringBean;
this.type = parameter.getBaseType();
}
- public Annotated getAnnotated() {
+ public Annotated getAnnotated()
+ {
return annotated;
}
- public Bean<?> getBean() {
+ public Bean<?> getBean()
+ {
return declaringBean;
}
- public Member getMember() {
+ public Member getMember()
+ {
return member;
}
- public Set<Annotation> getQualifiers() {
+ public Set<Annotation> getQualifiers()
+ {
return unmodifiableSet(qualifiers);
}
- public Type getType() {
+ public Type getType()
+ {
return type;
}
- public boolean isDelegate() {
+ public boolean isDelegate()
+ {
return delegate;
}
- public boolean isTransient() {
- return _transient;
+ public boolean isTransient()
+ {
+ return isTransient;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/e5166790/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/InjectableMethod.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/InjectableMethod.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/InjectableMethod.java
index 3ea3536..6d6337a 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/InjectableMethod.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/InjectableMethod.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.deltaspike.core.api.metadata.builder;
import java.util.ArrayList;
@@ -31,7 +49,8 @@ import static org.apache.deltaspike.core.util.Reflections.invokeMethod;
* @param <X> the declaring type
* @author Pete Muir
*/
-public class InjectableMethod<X> {
+public class InjectableMethod<X>
+{
private final AnnotatedMethod<X> method;
private final List<InjectionPoint> parameters;
@@ -46,7 +65,8 @@ public class InjectableMethod<X> {
* @param beanManager the {@link BeanManager} to use to obtain the parameter
* values
*/
- public InjectableMethod(AnnotatedMethod<X> method, Bean<?> declaringBean, BeanManager beanManager) {
+ public InjectableMethod(AnnotatedMethod<X> method, Bean<?> declaringBean, BeanManager beanManager)
+ {
this(method, createInjectionPoints(method, declaringBean, beanManager), beanManager);
}
@@ -60,7 +80,8 @@ public class InjectableMethod<X> {
* @param beanManager the {@link BeanManager} to use to obtain the parameter
* values
*/
- public InjectableMethod(AnnotatedMethod<X> method, Collection<InjectionPoint> parameters, BeanManager beanManager) {
+ public InjectableMethod(AnnotatedMethod<X> method, Collection<InjectionPoint> parameters, BeanManager beanManager)
+ {
this.method = method;
this.parameters = new ArrayList<InjectionPoint>(parameters);
this.beanManager = beanManager;
@@ -71,7 +92,8 @@ public class InjectableMethod<X> {
*
* @return the bean manager in use
*/
- protected BeanManager getBeanManager() {
+ protected BeanManager getBeanManager()
+ {
return beanManager;
}
@@ -81,16 +103,16 @@ public class InjectableMethod<X> {
* @return a collection of injection points representing the parameters of
* this method
*/
- protected List<InjectionPoint> getParameters() {
+ protected List<InjectionPoint> getParameters()
+ {
return parameters;
}
/**
* Invoke the method, causing all parameters to be injected according to the
* CDI type safe resolution rules.public class ParameterValueRedefiner {
-
-}
-
+ * <p/>
+ * }
*
* @param <T> the return type of the method
* @param receiver the instance upon which to call the method
@@ -115,7 +137,8 @@ public class InjectableMethod<X> {
* @throws ExceptionInInitializerError if the initialization provoked by this
* method fails.
*/
- public <T> T invoke(Object receiver, CreationalContext<T> creationalContext) {
+ public <T> T invoke(Object receiver, CreationalContext<T> creationalContext)
+ {
return invoke(receiver, creationalContext, null);
}
@@ -147,19 +170,25 @@ public class InjectableMethod<X> {
* @throws ExceptionInInitializerError if the initialization provoked by this
* method fails.
*/
- public <T> T invoke(Object receiver, CreationalContext<T> creationalContext, ParameterValueRedefiner redefinition) {
+ public <T> T invoke(Object receiver, CreationalContext<T> creationalContext, ParameterValueRedefiner redefinition)
+ {
List<Object> parameterValues = new ArrayList<Object>();
- for (int i = 0; i < getParameters().size(); i++) {
- if (redefinition != null) {
+ for (int i = 0; i < getParameters().size(); i++)
+ {
+ if (redefinition != null)
+ {
ParameterValue value = new ParameterValue(i, getParameters().get(i), getBeanManager());
parameterValues.add(redefinition.redefineParameterValue(value));
- } else {
+ }
+ else
+ {
parameterValues.add(getBeanManager().getInjectableReference(getParameters().get(i), creationalContext));
}
}
@SuppressWarnings("unchecked")
- T result = (T) invokeMethod(true, method.getJavaMember(), receiver, parameterValues.toArray(EMPTY_OBJECT_ARRAY));
+ T result = (T) invokeMethod(true, method.getJavaMember(), receiver, parameterValues
+ .toArray(EMPTY_OBJECT_ARRAY));
return result;
}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/e5166790/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/ParameterValueRedefiner.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/ParameterValueRedefiner.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/ParameterValueRedefiner.java
index be4b6d7..5bf6281 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/ParameterValueRedefiner.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/ParameterValueRedefiner.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.deltaspike.core.api.metadata.builder;
import javax.enterprise.context.spi.CreationalContext;
@@ -12,7 +30,17 @@ import javax.enterprise.inject.spi.InjectionPoint;
* @author Pete Muir
* @see InjectableMethod
*/
-public interface ParameterValueRedefiner {
+public interface ParameterValueRedefiner
+{
+ /**
+ * Callback allowing the default parameter value (that which would be
+ * injected according to the CDI type safe resolution rules) to be
+ * overridden.
+ *
+ * @param value the default value
+ * @return the overridden value
+ */
+ Object redefineParameterValue(ParameterValue value);
/**
* Provides the default parameter's value, along with metadata about the
@@ -22,13 +50,15 @@ public interface ParameterValueRedefiner {
* @see ParameterValueRedefiner
* @see InjectableMethod
*/
- public static class ParameterValue {
+ public static class ParameterValue
+ {
private final int position;
private final InjectionPoint injectionPoint;
private final BeanManager beanManager;
- ParameterValue(int position, InjectionPoint injectionPoint, BeanManager beanManager) {
+ ParameterValue(int position, InjectionPoint injectionPoint, BeanManager beanManager)
+ {
this.position = position;
this.injectionPoint = injectionPoint;
this.beanManager = beanManager;
@@ -39,7 +69,8 @@ public interface ParameterValueRedefiner {
*
* @return the position of the parameter
*/
- public int getPosition() {
+ public int getPosition()
+ {
return position;
}
@@ -48,7 +79,8 @@ public interface ParameterValueRedefiner {
*
* @return the injection point
*/
- public InjectionPoint getInjectionPoint() {
+ public InjectionPoint getInjectionPoint()
+ {
return injectionPoint;
}
@@ -60,20 +92,10 @@ public interface ParameterValueRedefiner {
* injectable reference.
* @return the default value
*/
- public Object getDefaultValue(CreationalContext<?> creationalContext) {
+ public Object getDefaultValue(CreationalContext<?> creationalContext)
+ {
return beanManager.getInjectableReference(injectionPoint, creationalContext);
}
}
-
- /**
- * Callback allowing the default parameter value (that which would be
- * injected according to the CDI type safe resolution rules) to be
- * overridden.
- *
- * @param value the default value
- * @return the overridden value
- */
- public Object redefineParameterValue(ParameterValue value);
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/e5166790/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/Beans.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/Beans.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/Beans.java
index f6c5a30..b140fb3 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/Beans.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/Beans.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.deltaspike.core.util;
import java.lang.annotation.Annotation;
@@ -27,9 +45,11 @@ import static org.apache.deltaspike.core.util.Reflections.isSerializable;
*
* @author Pete Muir
*/
-public class Beans {
+public class Beans
+{
- private Beans() {
+ private Beans()
+ {
}
/**
@@ -40,11 +60,15 @@ public class Beans {
* @param annotations the annotations to check
* @return any qualifiers present in <code>annotations</code>
*/
- public static Set<Annotation> getQualifiers(BeanManager beanManager, Iterable<Annotation>... annotations) {
+ public static Set<Annotation> getQualifiers(BeanManager beanManager, Iterable<Annotation>... annotations)
+ {
Set<Annotation> qualifiers = new HashSet<Annotation>();
- for (Iterable<Annotation> annotationSet : annotations) {
- for (Annotation annotation : annotationSet) {
- if (beanManager.isQualifier(annotation.annotationType())) {
+ for (Iterable<Annotation> annotationSet : annotations)
+ {
+ for (Annotation annotation : annotationSet)
+ {
+ if (beanManager.isQualifier(annotation.annotationType()))
+ {
qualifiers.add(annotation);
}
}
@@ -61,7 +85,8 @@ public class Beans {
* @return any qualifiers present in <code>annotations</code>
*/
@SuppressWarnings("unchecked")
- public static Set<Annotation> getQualifiers(BeanManager beanManager, Iterable<Annotation> annotations) {
+ public static Set<Annotation> getQualifiers(BeanManager beanManager, Iterable<Annotation> annotations)
+ {
return getQualifiers(beanManager, new Iterable[]{annotations});
}
@@ -73,11 +98,15 @@ public class Beans {
* @param annotations the annotations to check
* @return any qualifiers present in <code>annotations</code>
*/
- public static Set<Annotation> getQualifiers(BeanManager beanManager, Annotation[]... annotations) {
+ public static Set<Annotation> getQualifiers(BeanManager beanManager, Annotation[]... annotations)
+ {
Set<Annotation> qualifiers = new HashSet<Annotation>();
- for (Annotation[] annotationArray : annotations) {
- for (Annotation annotation : annotationArray) {
- if (beanManager.isQualifier(annotation.annotationType())) {
+ for (Annotation[] annotationArray : annotations)
+ {
+ for (Annotation annotation : annotationArray)
+ {
+ if (beanManager.isQualifier(annotation.annotationType()))
+ {
qualifiers.add(annotation);
}
}
@@ -85,31 +114,57 @@ public class Beans {
return qualifiers;
}
- public static void checkReturnValue(Object instance, Bean<?> bean, InjectionPoint injectionPoint, BeanManager beanManager) {
- if (instance == null && !Dependent.class.equals(bean.getScope())) {
+ public static void checkReturnValue(Object instance, Bean<?> bean, InjectionPoint injectionPoint,
+ BeanManager beanManager)
+ {
+ if (instance == null && !Dependent.class.equals(bean.getScope()))
+ {
throw new IllegalStateException("Cannot return null from a non-dependent producer method: " + bean);
- } else if (instance != null) {
+ }
+ else if (instance != null)
+ {
boolean passivating = beanManager.isPassivatingScope(bean.getScope());
boolean instanceSerializable = isSerializable(instance.getClass());
- if (passivating && !instanceSerializable) {
- throw new IllegalStateException("Producers cannot declare passivating scope and return a non-serializable class: " + bean);
+ if (passivating && !instanceSerializable)
+ {
+ throw new IllegalStateException(
+ "Producers cannot declare passivating scope and return a non-serializable class: " + bean);
}
- if (injectionPoint != null && injectionPoint.getBean() != null) {
- if (!instanceSerializable && beanManager.isPassivatingScope(injectionPoint.getBean().getScope())) {
- if (injectionPoint.getMember() instanceof Field) {
- if (!injectionPoint.isTransient() && instance != null && !instanceSerializable) {
- throw new IllegalStateException("Producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans. Producer " + bean + "at injection point " + injectionPoint);
+ if (injectionPoint != null && injectionPoint.getBean() != null)
+ {
+ if (!instanceSerializable && beanManager.isPassivatingScope(injectionPoint.getBean().getScope()))
+ {
+ if (injectionPoint.getMember() instanceof Field)
+ {
+ if (!injectionPoint.isTransient() && instance != null && !instanceSerializable)
+ {
+ throw new IllegalStateException(
+ "Producers cannot produce non-serializable instances for injection into " +
+ "non-transient fields of passivating beans. Producer " +
+ bean + "at injection point " + injectionPoint);
}
- } else if (injectionPoint.getMember() instanceof Method) {
+ }
+ else if (injectionPoint.getMember() instanceof Method)
+ {
Method method = (Method) injectionPoint.getMember();
- if (method.isAnnotationPresent(Inject.class)) {
- throw new IllegalStateException("Producers cannot produce non-serializable instances for injection into parameters of initializers of beans declaring passivating scope. Producer " + bean + "at injection point " + injectionPoint);
+ if (method.isAnnotationPresent(Inject.class))
+ {
+ throw new IllegalStateException("Producers cannot produce non-serializable instances for " +
+ "injection into parameters of initializers of beans declaring passivating scope. " +
+ "Producer " + bean + "at injection point " + injectionPoint);
}
- if (method.isAnnotationPresent(Produces.class)) {
- throw new IllegalStateException("Producers cannot produce non-serializable instances for injection into parameters of producer methods declaring passivating scope. Producer " + bean + "at injection point " + injectionPoint);
+ if (method.isAnnotationPresent(Produces.class))
+ {
+ throw new IllegalStateException("Producers cannot produce non-serializable instances for " +
+ "injection into parameters of producer methods declaring passivating scope. " +
+ "Producer " + bean + "at injection point " + injectionPoint);
}
- } else if (injectionPoint.getMember() instanceof Constructor<?>) {
- throw new IllegalStateException("Producers cannot produce non-serializable instances for injection into parameters of constructors of beans declaring passivating scope. Producer " + bean + "at injection point " + injectionPoint);
+ }
+ else if (injectionPoint.getMember() instanceof Constructor<?>)
+ {
+ throw new IllegalStateException("Producers cannot produce non-serializable instances for " +
+ "injection into parameters of constructors of beans declaring passivating scope. " +
+ "Producer " + bean + "at injection point " + injectionPoint);
}
}
}
@@ -126,10 +181,15 @@ public class Beans {
* @param beanManager the bean manager to use to create the injection points
* @return the injection points
*/
- public static <X> List<InjectionPoint> createInjectionPoints(AnnotatedMethod<X> method, Bean<?> declaringBean, BeanManager beanManager) {
+ public static <X> List<InjectionPoint> createInjectionPoints(AnnotatedMethod<X> method, Bean<?> declaringBean,
+ BeanManager beanManager)
+ {
List<InjectionPoint> injectionPoints = new ArrayList<InjectionPoint>();
- for (AnnotatedParameter<X> parameter : method.getParameters()) {
- InjectionPoint injectionPoint = new ImmutableInjectionPoint(parameter, beanManager, declaringBean, false, false);
+ for (AnnotatedParameter<X> parameter : method.getParameters())
+ {
+ InjectionPoint injectionPoint =
+ new ImmutableInjectionPoint(parameter, beanManager, declaringBean, false, false);
+
injectionPoints.add(injectionPoint);
}
return injectionPoints;