Permalink
Browse files

Fixed typo and made dynamic producer implement passivation capable

interface.
  • Loading branch information...
1 parent 8339bdd commit d5986117037e3f81dffac711639b86e038cfdbd9 arjan.tijms committed Sep 3, 2014
@@ -32,7 +32,7 @@
import javax.inject.Qualifier;
import org.omnifaces.cdi.param.Attribute;
-import org.omnifaces.cdi.param.DynamicParamValueProdcuer;
+import org.omnifaces.cdi.param.DynamicParamValueProducer;
import org.omnifaces.cdi.param.ParamExtension;
import org.omnifaces.cdi.param.ParamValue;
import org.omnifaces.cdi.param.RequestParameterProducer;
@@ -72,7 +72,7 @@
* @see Attribute
* @see ParamExtension
* @see RequestParameterProducer
- * @see DynamicParamValueProdcuer
+ * @see DynamicParamValueProducer
*
*/
@Qualifier
@@ -16,6 +16,7 @@
import static java.util.Collections.emptySet;
import static org.omnifaces.util.Beans.getCurrentInjectionPoint;
+import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Collections;
@@ -27,6 +28,7 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.PassivationCapable;
import javax.enterprise.util.AnnotationLiteral;
import javax.faces.convert.Converter;
import javax.faces.validator.Validator;
@@ -46,12 +48,14 @@
* @author Arjan Tijms
*
*/
-public class DynamicParamValueProdcuer implements Bean<Object> {
+public class DynamicParamValueProducer implements Bean<Object>, Serializable, PassivationCapable {
+ private static final long serialVersionUID = 1L;
+
private BeanManager beanManager;
private Set<Type> types;
- public DynamicParamValueProdcuer(BeanManager beanManager, Type type) {
+ public DynamicParamValueProducer(BeanManager beanManager, Type type) {
this.beanManager = beanManager;
types = new HashSet<>(asList(type, Object.class));
}
@@ -111,6 +115,11 @@ public String getName() {
public void destroy(Object instance, CreationalContext<Object> creationalContext) {
// NOOP
}
+
+ @Override
+ public String getId() {
+ return DynamicParamValueProducer.class.getName() + "_" + (types != null ? types.toString() : "");
+ }
@SuppressWarnings("all")
public static class DefaultParamAnnotationLiteral extends AnnotationLiteral<Param> implements Param {
@@ -52,7 +52,7 @@
public void afterBean(final @Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) {
for (Type type : types) {
- afterBeanDiscovery.addBean(new DynamicParamValueProdcuer(beanManager, type));
+ afterBeanDiscovery.addBean(new DynamicParamValueProducer(beanManager, type));
}
}

0 comments on commit d598611

Please sign in to comment.