You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by st...@apache.org on 2012/06/15 15:00:51 UTC

git commit: DELTASPIKE-201 move to util.bean package and improve JavaDoc

Updated Branches:
  refs/heads/master 306d6be46 -> bc187acb6


DELTASPIKE-201 move to util.bean package and improve JavaDoc

I also made all data classes and ct public as they might get reused
in other extensions as well.


Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/bc187acb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/bc187acb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/bc187acb

Branch: refs/heads/master
Commit: bc187acb64c3b71788e2731e389c8fd027e777ec
Parents: 306d6be
Author: Mark Struberg <st...@apache.org>
Authored: Fri Jun 15 14:59:56 2012 +0200
Committer: Mark Struberg <st...@apache.org>
Committed: Fri Jun 15 14:59:56 2012 +0200

----------------------------------------------------------------------
 .../core/util/bean/AbstractImmutableBean.java      |  227 ++++++++
 .../core/util/bean/ImmutableBeanWrapper.java       |  115 ++++
 .../ImmutablePassivationCapableBeanWrapper.java    |   74 +++
 .../core/util/bean/WrappingBeanBuilder.java        |  453 +++++++++++++++
 .../core/util/builder/AbstractImmutableBean.java   |  227 --------
 .../core/util/builder/ImmutableBeanWrapper.java    |  124 ----
 .../ImmutablePassivationCapableBeanWrapper.java    |   57 --
 .../core/util/builder/WrappingBeanBuilder.java     |  453 ---------------
 .../core/impl/message/MessageBundleExtension.java  |    2 +-
 9 files changed, 870 insertions(+), 862 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bc187acb/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/AbstractImmutableBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/AbstractImmutableBean.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/AbstractImmutableBean.java
new file mode 100644
index 0000000..3377d6f
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/AbstractImmutableBean.java
@@ -0,0 +1,227 @@
+/*
+ * 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.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.deltaspike.core.api.literal.DefaultLiteral;
+import org.apache.deltaspike.core.util.ArraysUtils;
+
+/**
+ * <p>
+ * A base class for implementing {@link Bean}. The attributes are immutable, and
+ * collections are defensively copied on instantiation. It uses the defaults
+ * from the specification for properties if not specified.
+ * </p>
+ * <p/>
+ * <p>
+ * This class does not provide any bean lifecycle operations
+ * </p>
+ *
+ * @see ImmutableBeanWrapper
+ */
+public abstract class AbstractImmutableBean<T> implements Bean<T>
+{
+    private static final Logger LOG = Logger.getLogger(AbstractImmutableBean.class.getName());
+
+    private final Class<?> beanClass;
+    private final String name;
+    private final Set<Annotation> qualifiers;
+    private final Class<? extends Annotation> scope;
+    private final Set<Class<? extends Annotation>> stereotypes;
+    private final Set<Type> types;
+    private final boolean alternative;
+    private final boolean nullable;
+    private final Set<InjectionPoint> injectionPoints;
+    private final String toString;
+
+    /**
+     * Create a new, immutable bean. All arguments passed as collections are
+     * defensively copied.
+     *
+     * @param beanClass       The Bean class, may not be null
+     * @param name            The bean name
+     * @param qualifiers      The bean's qualifiers, if null, a singleton set of
+     *                        {@link javax.enterprise.inject.Default} is used
+     * @param scope           The bean's scope, if null, the default scope of
+     *                        {@link Dependent} is used
+     * @param stereotypes     The bean's stereotypes, if null, an empty set is used
+     * @param types           The bean's types, if null, the beanClass and {@link Object}
+     *                        will be used
+     * @param alternative     True if the bean is an alternative
+     * @param nullable        True if the bean is nullable
+     * @param injectionPoints the bean's injection points, if null an empty set is used
+     * @param toString        the string which should be returned by #{@link #toString()}
+     * @throws IllegalArgumentException if the beanClass is null
+     */
+    public AbstractImmutableBean(Class<?> beanClass,
+                                 String name,
+                                 Set<Annotation> qualifiers,
+                                 Class<? extends Annotation> scope,
+                                 Set<Class<? extends Annotation>> stereotypes,
+                                 Set<Type> types,
+                                 boolean alternative,
+                                 boolean nullable,
+                                 Set<InjectionPoint> injectionPoints,
+                                 String toString)
+    {
+        if (beanClass == null)
+        {
+            throw new IllegalArgumentException("beanClass cannot be null");
+        }
+
+        this.beanClass = beanClass;
+        this.name = name;
+
+        if (qualifiers == null)
+        {
+            this.qualifiers = Collections.<Annotation>singleton(new DefaultLiteral());
+
+            LOG.finest("No qualifers provided for bean class " + beanClass + ", using singleton set of @Default");
+        }
+        else
+        {
+            this.qualifiers = new HashSet<Annotation>(qualifiers);
+        }
+
+        if (scope == null)
+        {
+            this.scope = Dependent.class;
+
+            LOG.finest("No scope provided for bean class " + beanClass + ", using @Dependent");
+        }
+        else
+        {
+            this.scope = scope;
+        }
+
+        if (stereotypes == null)
+        {
+            this.stereotypes = Collections.emptySet();
+        }
+        else
+        {
+            this.stereotypes = new HashSet<Class<? extends Annotation>>(stereotypes);
+        }
+
+        if (types == null)
+        {
+            //noinspection unchecked
+            this.types = ArraysUtils.<Type>asSet(Object.class, beanClass);
+
+            LOG.finest("No types provided for bean class " + beanClass
+                    + ", using [java.lang.Object.class, " + beanClass.getName()
+                    + ".class]");
+        }
+        else
+        {
+            this.types = new HashSet<Type>(types);
+        }
+
+        if (injectionPoints == null)
+        {
+            this.injectionPoints = Collections.emptySet();
+        }
+        else
+        {
+            this.injectionPoints = new HashSet<InjectionPoint>(injectionPoints);
+        }
+
+        this.alternative = alternative;
+        this.nullable = nullable;
+
+        if (toString != null)
+        {
+            this.toString = toString;
+        }
+        else
+        {
+            this.toString = "Custom Bean with bean class " + beanClass + " and qualifiers " + qualifiers;
+        }
+    }
+
+    @Override
+    public Class<?> getBeanClass()
+    {
+        return beanClass;
+    }
+
+    @Override
+    public Set<InjectionPoint> getInjectionPoints()
+    {
+        return injectionPoints;
+    }
+
+    @Override
+    public String getName()
+    {
+        return name;
+    }
+
+    @Override
+    public Set<Annotation> getQualifiers()
+    {
+        return Collections.unmodifiableSet(qualifiers);
+    }
+
+    @Override
+    public Class<? extends Annotation> getScope()
+    {
+        return scope;
+    }
+
+    @Override
+    public Set<Class<? extends Annotation>> getStereotypes()
+    {
+        return Collections.unmodifiableSet(stereotypes);
+    }
+
+    @Override
+    public Set<Type> getTypes()
+    {
+        return Collections.unmodifiableSet(types);
+    }
+
+    @Override
+    public boolean isAlternative()
+    {
+        return alternative;
+    }
+
+    @Override
+    public boolean isNullable()
+    {
+        return nullable;
+    }
+
+    @Override
+    public String toString()
+    {
+        return toString;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bc187acb/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/ImmutableBeanWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/ImmutableBeanWrapper.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/ImmutableBeanWrapper.java
new file mode 100644
index 0000000..220acde
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/ImmutableBeanWrapper.java
@@ -0,0 +1,115 @@
+/*
+ * 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.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+/**
+ * <p>
+ * This bean-wrapper allows you to build a general purpose bean (likely a
+ * producer method), and register it for a narrowed type (or qualifiers).
+ * You can easily create instances of this class with the
+ * {@link WrappingBeanBuilder}.
+ * </p>
+ *
+ * <p>For example, you could create a producer method which uses an a
+ * String ID tolocated an object (the object can have any class):</p>
+ * <pre>
+ * &#064;Produces
+ * // Use some synthetic scope to prevent this from interfering with other
+ * // resolutions
+ * &#064;MyProducer
+ * Object produce(InjectionPoint ip)
+ * {
+ *     String id = ip.getAnnotated().getAnnotation(Id.class).value();
+ *     // Lookup and return the object for the id
+ * }
+ * </pre>
+ * <p>The wrapped bean <em>must</em> return an object which can be cast to the
+ * type <code>T</code>, otherwise a {@link ClassCastException} will be thrown at
+ * runtime when the bean is created.
+ * </p>
+ * <p>You can then register a narrowing bean for each type you need:
+ * </p>
+ * <pre>
+ * event.addBean(new NarrowingBeanBuilder&lt;T&gt;(delegateBean).readFromType(type)
+ *         .create());
+ * </pre>
+ * <p>{@link ImmutableBeanWrapper} will use the annotations on
+ * <code>definingType</code> to discover the qualifiers, types, scope,
+ * stereotypes of the bean, as well as determine it's name (if any) and whether
+ * it is an alternative.
+ * </p>
+ * <p>The attributes are immutable, and collections are defensively copied on
+ * instantiation. It uses the defaults from the specification for properties if
+ * not specified.
+ * </p>
+ *
+ * @see org.apache.deltaspike.core.util.bean.WrappingBeanBuilder
+ */
+public class ImmutableBeanWrapper<T> extends AbstractImmutableBean<T>
+{
+    private final Bean<T> wrapped;
+
+    /**
+     * Instantiate a new {@link ImmutableBeanWrapper}.
+     *
+     * @param bean        the bean to wrapped the lifecycle to
+     * @param name        the name of the bean
+     * @param qualifiers  the qualifiers of the bean
+     * @param scope       the scope of the bean
+     * @param stereotypes the bean's stereotypes
+     * @param types       the types of the bean
+     * @param alternative whether the bean is an alternative
+     * @param nullable    true if the bean is nullable
+     * @param toString    the string which should be returned by #{@link #toString()}
+     */
+    public ImmutableBeanWrapper(Bean<T> bean,
+                                String name,
+                                Set<Annotation> qualifiers,
+                                Class<? extends Annotation> scope,
+                                Set<Class<? extends Annotation>> stereotypes,
+                                Set<Type> types,
+                                boolean alternative,
+                                boolean nullable,
+                                String toString)
+    {
+        super(bean.getBeanClass(), name, qualifiers, scope, stereotypes,
+            types, alternative, nullable, bean.getInjectionPoints(), toString);
+
+        wrapped = bean;
+    }
+
+    @Override
+    public T create(CreationalContext<T> creationalContext)
+    {
+        return wrapped.create(creationalContext);
+    }
+
+    @Override
+    public void destroy(T instance, CreationalContext<T> creationalContext)
+    {
+        wrapped.destroy(instance, creationalContext);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bc187acb/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/ImmutablePassivationCapableBeanWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/ImmutablePassivationCapableBeanWrapper.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/ImmutablePassivationCapableBeanWrapper.java
new file mode 100644
index 0000000..191c295
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/ImmutablePassivationCapableBeanWrapper.java
@@ -0,0 +1,74 @@
+/*
+ * 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.bean;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.PassivationCapable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+/**
+ * <p>PassivationCapable version of an ImmutableBeanWrapper.
+ *  You can easily create instances of this class with the
+ * {@link WrappingBeanBuilder}.</p>
+ *
+ * @see ImmutableBeanWrapper
+ * @see WrappingBeanBuilder
+ */
+public class ImmutablePassivationCapableBeanWrapper<T> extends ImmutableBeanWrapper<T>
+        implements PassivationCapable
+{
+    private String id;
+
+    /**
+     * Instantiate a new {@link ImmutableBeanWrapper} for a  {@link PassivationCapable} Bean.
+     *
+     * @param bean        the bean to wrapped the lifecycle to
+     * @param name        the name of the bean
+     * @param qualifiers  the qualifiers of the bean
+     * @param scope       the scope of the bean
+     * @param stereotypes the bean's stereotypes
+     * @param types       the types of the bean
+     * @param alternative whether the bean is an alternative
+     * @param nullable    true if the bean is nullable
+     * @param toString    the string which should be returned by #{@link #toString()}
+     * @param id          the passivationId which gets returned by {@link #getId()}
+     */
+    public ImmutablePassivationCapableBeanWrapper(Bean<T> bean,
+                                                  String name,
+                                                  Set<Annotation> qualifiers,
+                                                  Class<? extends Annotation> scope,
+                                                  Set<Class<? extends Annotation>> stereotypes,
+                                                  Set<Type> types,
+                                                  boolean alternative,
+                                                  boolean nullable,
+                                                  String toString,
+                                                  String id)
+    {
+        super(bean, name, qualifiers, scope, stereotypes, types, alternative, nullable, toString);
+        this.id = id;
+    }
+
+    @Override
+    public String getId()
+    {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bc187acb/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/WrappingBeanBuilder.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/WrappingBeanBuilder.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/WrappingBeanBuilder.java
new file mode 100644
index 0000000..9367e10
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/WrappingBeanBuilder.java
@@ -0,0 +1,453 @@
+/*
+ * 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.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Named;
+
+import org.apache.deltaspike.core.api.literal.AnyLiteral;
+import org.apache.deltaspike.core.api.literal.DefaultLiteral;
+import org.apache.deltaspike.core.util.ArraysUtils;
+
+/**
+ * <p>A WrappingBeanBuilder helps creating Beans which internally
+ * just wrap another existing Bean. The Types, Qualifiers
+ * and other attributes of the resulting Bean can be modified.</p>
+ *
+ * <p>The {@link Bean#create(javax.enterprise.context.spi.CreationalContext)}
+ * and {@link Bean#destroy(Object, javax.enterprise.context.spi.CreationalContext)}
+ * methods will get delegated to the underlying wrapped Bean.</p>
+ *
+ * @param <T> the type of the Bean
+ */
+public class WrappingBeanBuilder<T>
+{
+    private final Bean<T> delegate;
+    private final BeanManager beanManager;
+
+    private Set<Type> types;
+    private Set<Annotation> qualifiers;
+    private String name;
+    private Class<? extends Annotation> scope;
+    private boolean alternative;
+    private boolean nullable;
+    private String toString;
+    private Set<Class<? extends Annotation>> stereotypes;
+    private boolean passivationCapable;
+    private String id;
+
+    /**
+     * Instantiate a new {@link WrappingBeanBuilder}.
+     *
+     * @param delegate    the delegate bean
+     * @param beanManager current bean-manager
+     */
+    public WrappingBeanBuilder(Bean<Object> delegate, BeanManager beanManager)
+    {
+        this.delegate = (Bean<T>)delegate;
+        this.beanManager = beanManager;
+    }
+
+    /**
+     * <p>
+     * Read the {@link AnnotatedType}, creating a narrowing bean from the class
+     * and its annotations.
+     * </p>
+     *
+     * @param type the type to read
+     */
+    public WrappingBeanBuilder<T> readFromType(AnnotatedType<T> type)
+    {
+        types = new HashSet<Type>(type.getTypeClosure());
+        qualifiers = new HashSet<Annotation>();
+        stereotypes = new HashSet<Class<? extends Annotation>>();
+        String name = null;
+        Class<? extends Annotation> scope = Dependent.class;
+
+        for (Annotation annotation : type.getAnnotations())
+        {
+            if (beanManager.isQualifier(annotation.annotationType()))
+            {
+                qualifiers.add(annotation);
+            }
+            else if (annotation.annotationType().equals(Named.class))
+            {
+                name = Named.class.cast(annotation).value();
+            }
+            else if (beanManager.isScope(annotation.annotationType()))
+            {
+                scope = annotation.annotationType();
+            }
+            else if (beanManager.isStereotype(annotation.annotationType()))
+            {
+                stereotypes.add(annotation.annotationType());
+            }
+        }
+        if (qualifiers.isEmpty())
+        {
+            qualifiers.add(new DefaultLiteral());
+        }
+        qualifiers.add(new AnyLiteral());
+        this.name = "".equals(name) ? null : name;
+        this.scope = scope;
+        alternative = type.isAnnotationPresent(Alternative.class);
+        return this;
+    }
+
+    /**
+     * Type closure currently defined for bean creation.
+     *
+     * @return the type closure currently defined
+     */
+    public Set<Type> getTypes()
+    {
+        return types;
+    }
+
+    /**
+     * Define the type closure used for bean creation.
+     *
+     * @param types the type closure to use
+     */
+    public WrappingBeanBuilder<T> types(Set<Type> types)
+    {
+        this.types = types;
+        return this;
+    }
+
+    /**
+     * Define the type closure used for bean creation.
+     *
+     * @param types the type closure to use
+     */
+    public WrappingBeanBuilder<T> types(Type... types)
+    {
+        this.types = ArraysUtils.asSet(types);
+        return this;
+    }
+
+    /**
+     * Add to the type closure used for bean creation.
+     *
+     * @param type additional type to use
+     */
+    public WrappingBeanBuilder<T> addType(Type type)
+    {
+        types.add(type);
+        return this;
+    }
+
+    /**
+     * Add to the type closure used for bean creation.
+     *
+     * @param types the additional types to use
+     */
+    public WrappingBeanBuilder<T> addTypes(Type... types)
+    {
+        this.types.addAll(ArraysUtils.asSet(types));
+        return this;
+    }
+
+    /**
+     * Add to the type closure used for bean creation.
+     *
+     * @param types the additional types to use
+     */
+    public WrappingBeanBuilder<T> addTypes(Collection<Type> types)
+    {
+        this.types.addAll(types);
+        return this;
+    }
+
+    /**
+     * Qualifiers currently defined for bean creation.
+     *
+     * @return the qualifiers current defined
+     */
+    public Set<Annotation> getQualifiers()
+    {
+        return qualifiers;
+    }
+
+    /**
+     * Define the qualifiers used for bean creation.
+     *
+     * @param qualifiers the qualifiers to use
+     */
+    public WrappingBeanBuilder<T> qualifiers(Set<Annotation> qualifiers)
+    {
+        this.qualifiers = qualifiers;
+        return this;
+    }
+
+    /**
+     * Define the qualifiers used for bean creation.
+     *
+     * @param qualifiers the qualifiers to use
+     */
+    public WrappingBeanBuilder<T> qualifiers(Annotation... qualifiers)
+    {
+        this.qualifiers = ArraysUtils.asSet(qualifiers);
+        return this;
+    }
+
+    /**
+     * Add to the qualifiers used for bean creation.
+     *
+     * @param qualifier the additional qualifier to use
+     */
+    public WrappingBeanBuilder<T> addQualifier(Annotation qualifier)
+    {
+        qualifiers.add(qualifier);
+        return this;
+    }
+
+    /**
+     * Add to the qualifiers used for bean creation.
+     *
+     * @param qualifiers the additional qualifiers to use
+     */
+    public WrappingBeanBuilder<T> addQualifiers(Annotation... qualifiers)
+    {
+        this.qualifiers.addAll(ArraysUtils.asSet(qualifiers));
+        return this;
+    }
+
+    /**
+     * Add to the qualifiers used for bean creation.
+     *
+     * @param qualifiers the additional qualifiers to use
+     */
+    public WrappingBeanBuilder<T> addQualifiers(
+            Collection<Annotation> qualifiers)
+    {
+        this.qualifiers.addAll(qualifiers);
+        return this;
+    }
+
+    /**
+     * The name of the bean currently defined for bean creation.
+     *
+     * @return the name of the bean or <code>null</code> if the bean has no name
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * Define the name of the bean used for bean creation.
+     *
+     * @param name the name of the bean to use or <code>null</code> if the bean
+     *             should have no name
+     */
+    public WrappingBeanBuilder<T> name(String name)
+    {
+        this.name = name;
+        return this;
+    }
+
+    /**
+     * Scope currently defined for bean creation.
+     *
+     * @return the scope currently defined
+     */
+    public Class<? extends Annotation> getScope()
+    {
+        return scope;
+    }
+
+    /**
+     * Define the scope used for bean creation.
+     *
+     * @param scope the scope to use
+     */
+    public WrappingBeanBuilder<T> scope(Class<? extends Annotation> scope)
+    {
+        this.scope = scope;
+        return this;
+    }
+
+    /**
+     * Whether the created bean will be an alternative.
+     *
+     * @return <code>true</code> if the created bean will be an alternative,
+     *         otherwise <code>false</code>
+     */
+    public boolean isAlternative()
+    {
+        return alternative;
+    }
+
+    /**
+     * Define that the created bean will (or will not) be an alternative.
+     *
+     * @param alternative <code>true</code> if the created bean should be an
+     *                    alternative, otherwise <code>false</code>
+     */
+    public WrappingBeanBuilder<T> alternative(boolean alternative)
+    {
+        this.alternative = alternative;
+        return this;
+    }
+
+    /**
+     * Stereotypes currently defined for bean creation.
+     *
+     * @return the stereotypes currently defined
+     */
+    public Set<Class<? extends Annotation>> getStereotypes()
+    {
+        return stereotypes;
+    }
+
+    /**
+     * Define the stereotypes used for bean creation.
+     *
+     * @param stereotypes the stereotypes to use
+     */
+    public WrappingBeanBuilder<T> stereotypes(
+            Set<Class<? extends Annotation>> stereotypes)
+    {
+        this.stereotypes = stereotypes;
+        return this;
+    }
+
+    /**
+     * <p>
+     * Use the bean builder's current state to define the bean.
+     * </p>
+     *
+     * @return the bean
+     */
+    public ImmutableBeanWrapper<T> create()
+    {
+        if (isPassivationCapable())
+        {
+            return new ImmutablePassivationCapableBeanWrapper<T>(delegate,
+                    name, qualifiers, scope, stereotypes, types, alternative,
+                    nullable, toString, id);
+        }
+        else
+        {
+            return new ImmutableBeanWrapper<T>(delegate, name, qualifiers, scope,
+                    stereotypes, types, alternative, nullable, toString);
+        }
+    }
+
+    // }
+
+    /**
+     * The string used when {@link #toString()} is called on the bean.
+     *
+     * @return the string currently defined
+     */
+    public String getToString()
+    {
+        return toString;
+    }
+
+    /**
+     * Define the string used when {@link #toString()} is called on the bean.
+     *
+     * @param toString the string to use
+     */
+    public WrappingBeanBuilder<T> toString(String toString)
+    {
+        this.toString = toString;
+        return this;
+    }
+
+    /**
+     * Whether the created bean will be nullable.
+     *
+     * @return <code>true</code> if the created bean will be nullable, otherwise
+     *         <code>false</code>
+     */
+    public boolean isNullable()
+    {
+        return nullable;
+    }
+
+    /**
+     * Define that the created bean will (or will not) be nullable.
+     *
+     * @param nullable <code>true</code> if the created bean should be nullable,
+     *                 otherwise <code>false</code>
+     */
+    public WrappingBeanBuilder<T> nullable(boolean nullable)
+    {
+        this.nullable = nullable;
+        return this;
+    }
+
+    /**
+     * Whether the created bean will be passivation capable.
+     *
+     * @return <code>true</code> if the created bean will be passivation
+     *         capable, otherwise <code>false</code>
+     */
+    public boolean isPassivationCapable()
+    {
+        return passivationCapable;
+    }
+
+    /**
+     * Define that the created bean will (or will not) be passivation capable.
+     *
+     * @param passivationCapable <code>true</code> if the created bean should be passivation
+     *                           capable, otherwise <code>false</code>
+     */
+    public WrappingBeanBuilder<T> passivationCapable(boolean passivationCapable)
+    {
+        this.passivationCapable = passivationCapable;
+        return this;
+    }
+
+    /**
+     * The id currently defined for bean creation.
+     *
+     * @return the id currently defined.
+     */
+    public String getId()
+    {
+        return id;
+    }
+
+    /**
+     * Define the id used for bean creation.
+     *
+     * @param id the id to use
+     */
+    public WrappingBeanBuilder<T> id(String id)
+    {
+        this.id = id;
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bc187acb/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/AbstractImmutableBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/AbstractImmutableBean.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/AbstractImmutableBean.java
deleted file mode 100644
index fb1907a..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/AbstractImmutableBean.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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.builder;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.apache.deltaspike.core.api.literal.DefaultLiteral;
-import org.apache.deltaspike.core.util.ArraysUtils;
-
-/**
- * <p>
- * A base class for implementing {@link Bean}. The attributes are immutable, and
- * collections are defensively copied on instantiation. It uses the defaults
- * from the specification for properties if not specified.
- * </p>
- * <p/>
- * <p>
- * This class does not provide any bean lifecycle operations
- * </p>
- *
- * @see ImmutableBeanWrapper
- */
-abstract class AbstractImmutableBean<T> implements Bean<T>
-{
-    private static final Logger LOG = Logger.getLogger(AbstractImmutableBean.class.getName());
-
-    private final Class<?> beanClass;
-    private final String name;
-    private final Set<Annotation> qualifiers;
-    private final Class<? extends Annotation> scope;
-    private final Set<Class<? extends Annotation>> stereotypes;
-    private final Set<Type> types;
-    private final boolean alternative;
-    private final boolean nullable;
-    private final Set<InjectionPoint> injectionPoints;
-    private final String toString;
-
-    /**
-     * Create a new, immutable bean. All arguments passed as collections are
-     * defensively copied.
-     *
-     * @param beanClass       The Bean class, may not be null
-     * @param name            The bean name
-     * @param qualifiers      The bean's qualifiers, if null, a singleton set of
-     *                        {@link javax.enterprise.inject.Default} is used
-     * @param scope           The bean's scope, if null, the default scope of
-     *                        {@link Dependent} is used
-     * @param stereotypes     The bean's stereotypes, if null, an empty set is used
-     * @param types           The bean's types, if null, the beanClass and {@link Object}
-     *                        will be used
-     * @param alternative     True if the bean is an alternative
-     * @param nullable        True if the bean is nullable
-     * @param injectionPoints the bean's injection points, if null an empty set is used
-     * @param toString        the string which should be returned by #{@link #toString()}
-     * @throws IllegalArgumentException if the beanClass is null
-     */
-    public AbstractImmutableBean(Class<?> beanClass,
-                                 String name,
-                                 Set<Annotation> qualifiers,
-                                 Class<? extends Annotation> scope,
-                                 Set<Class<? extends Annotation>> stereotypes,
-                                 Set<Type> types,
-                                 boolean alternative,
-                                 boolean nullable,
-                                 Set<InjectionPoint> injectionPoints,
-                                 String toString)
-    {
-        if (beanClass == null)
-        {
-            throw new IllegalArgumentException("beanClass cannot be null");
-        }
-
-        this.beanClass = beanClass;
-        this.name = name;
-
-        if (qualifiers == null)
-        {
-            this.qualifiers = Collections.<Annotation>singleton(new DefaultLiteral());
-
-            LOG.finest("No qualifers provided for bean class " + beanClass + ", using singleton set of @Default");
-        }
-        else
-        {
-            this.qualifiers = new HashSet<Annotation>(qualifiers);
-        }
-
-        if (scope == null)
-        {
-            this.scope = Dependent.class;
-
-            LOG.finest("No scope provided for bean class " + beanClass + ", using @Dependent");
-        }
-        else
-        {
-            this.scope = scope;
-        }
-
-        if (stereotypes == null)
-        {
-            this.stereotypes = Collections.emptySet();
-        }
-        else
-        {
-            this.stereotypes = new HashSet<Class<? extends Annotation>>(stereotypes);
-        }
-
-        if (types == null)
-        {
-            //noinspection unchecked
-            this.types = ArraysUtils.<Type>asSet(Object.class, beanClass);
-
-            LOG.finest("No types provided for bean class " + beanClass
-                    + ", using [java.lang.Object.class, " + beanClass.getName()
-                    + ".class]");
-        }
-        else
-        {
-            this.types = new HashSet<Type>(types);
-        }
-
-        if (injectionPoints == null)
-        {
-            this.injectionPoints = Collections.emptySet();
-        }
-        else
-        {
-            this.injectionPoints = new HashSet<InjectionPoint>(injectionPoints);
-        }
-
-        this.alternative = alternative;
-        this.nullable = nullable;
-
-        if (toString != null)
-        {
-            this.toString = toString;
-        }
-        else
-        {
-            this.toString = "Custom Bean with bean class " + beanClass + " and qualifiers " + qualifiers;
-        }
-    }
-
-    @Override
-    public Class<?> getBeanClass()
-    {
-        return beanClass;
-    }
-
-    @Override
-    public Set<InjectionPoint> getInjectionPoints()
-    {
-        return injectionPoints;
-    }
-
-    @Override
-    public String getName()
-    {
-        return name;
-    }
-
-    @Override
-    public Set<Annotation> getQualifiers()
-    {
-        return Collections.unmodifiableSet(qualifiers);
-    }
-
-    @Override
-    public Class<? extends Annotation> getScope()
-    {
-        return scope;
-    }
-
-    @Override
-    public Set<Class<? extends Annotation>> getStereotypes()
-    {
-        return Collections.unmodifiableSet(stereotypes);
-    }
-
-    @Override
-    public Set<Type> getTypes()
-    {
-        return Collections.unmodifiableSet(types);
-    }
-
-    @Override
-    public boolean isAlternative()
-    {
-        return alternative;
-    }
-
-    @Override
-    public boolean isNullable()
-    {
-        return nullable;
-    }
-
-    @Override
-    public String toString()
-    {
-        return toString;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bc187acb/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/ImmutableBeanWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/ImmutableBeanWrapper.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/ImmutableBeanWrapper.java
deleted file mode 100644
index 9f80f73..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/ImmutableBeanWrapper.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.builder;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-
-/**
- * <p>
- * This bean-wrapper allows you to build a general purpose bean (likely a
- * producer method), and register it for a narrowed type (or qualifiers). For
- * example, you could create a producer method which uses an a String ID to
- * located an object (the object can have any class):
- * </p>
- * <p/>
- * <p/>
- * <pre>
- * &#064;Produces
- * // Use some synthetic scope to prevent this from interfering with other
- * // resolutions
- * &#064;MyProducer
- * Object produce(InjectionPoint ip)
- * {
- *     String id = ip.getAnnotated().getAnnotation(Id.class).value();
- *     // Lookup and return the object for the id
- * }
- * </pre>
- * <p/>
- * <p>
- * The wrapped bean <em>must</em> return an object which can be cast to the
- * type <code>T</code>, otherwise a {@link ClassCastException} will be thrown at
- * runtime when the bean is created.
- * </p>
- * <p/>
- * <p>
- * You can then register a narrowing bean for each type you need:
- * </p>
- * <p/>
- * <p/>
- * <pre>
- * event.addBean(new NarrowingBeanBuilder&lt;T&gt;(delegateBean).readFromType(type)
- *         .create());
- * </pre>
- * <p/>
- * <p>
- * {@link ImmutableBeanWrapper} will use the annotations on
- * <code>definingType</code> to discover the qualifiers, types, scope,
- * stereotypes of the bean, as well as determine it's name (if any) and whether
- * it is an alternative.
- * </p>
- * <p/>
- * <p>
- * The attributes are immutable, and collections are defensively copied on
- * instantiation. It uses the defaults from the specification for properties if
- * not specified.
- * </p>
- *
- * @see WrappingBeanBuilder
- */
-class ImmutableBeanWrapper<T> extends AbstractImmutableBean<T>
-{
-    private final Bean<T> wrapped;
-
-    /**
-     * Instantiate a new {@link ImmutableBeanWrapper}.
-     *
-     * @param bean        the bean to wrapped the lifecycle to
-     * @param name        the name of the bean
-     * @param qualifiers  the qualifiers of the bean
-     * @param scope       the scope of the bean
-     * @param stereotypes the bean's stereotypes
-     * @param types       the types of the bean
-     * @param alternative whether the bean is an alternative
-     * @param nullable    true if the bean is nullable
-     * @param toString    the string which should be returned by #{@link #toString()}
-     */
-    public ImmutableBeanWrapper(Bean<T> bean,
-                                String name,
-                                Set<Annotation> qualifiers,
-                                Class<? extends Annotation> scope,
-                                Set<Class<? extends Annotation>> stereotypes,
-                                Set<Type> types,
-                                boolean alternative,
-                                boolean nullable,
-                                String toString)
-    {
-        super(bean.getBeanClass(), name, qualifiers, scope, stereotypes,
-            types, alternative, nullable, bean.getInjectionPoints(), toString);
-
-        wrapped = bean;
-    }
-
-    @Override
-    public T create(CreationalContext<T> creationalContext)
-    {
-        return wrapped.create(creationalContext);
-    }
-
-    @Override
-    public void destroy(T instance, CreationalContext<T> creationalContext)
-    {
-        wrapped.destroy(instance, creationalContext);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bc187acb/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/ImmutablePassivationCapableBeanWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/ImmutablePassivationCapableBeanWrapper.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/ImmutablePassivationCapableBeanWrapper.java
deleted file mode 100644
index 89b6a2c..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/ImmutablePassivationCapableBeanWrapper.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.builder;
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.PassivationCapable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-/**
- * PassivationCapable version of an ImmutableBeanWrapper.
- *
- * @see ImmutableBeanWrapper
- */
-public class ImmutablePassivationCapableBeanWrapper<T> extends ImmutableBeanWrapper<T>
-        implements PassivationCapable
-{
-    private String id;
-
-    public ImmutablePassivationCapableBeanWrapper(Bean<T> delegate,
-                                                  String name,
-                                                  Set<Annotation> qualifiers,
-                                                  Class<? extends Annotation> scope,
-                                                  Set<Class<? extends Annotation>> stereotypes,
-                                                  Set<Type> types,
-                                                  boolean alternative,
-                                                  boolean nullable,
-                                                  String toString,
-                                                  String id)
-    {
-        super(delegate, name, qualifiers, scope, stereotypes, types, alternative, nullable, toString);
-        this.id = id;
-    }
-
-    @Override
-    public String getId()
-    {
-        return id;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bc187acb/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/WrappingBeanBuilder.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/WrappingBeanBuilder.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/WrappingBeanBuilder.java
deleted file mode 100644
index d130f89..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/builder/WrappingBeanBuilder.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * 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.builder;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.inject.Alternative;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Named;
-
-import org.apache.deltaspike.core.api.literal.AnyLiteral;
-import org.apache.deltaspike.core.api.literal.DefaultLiteral;
-import org.apache.deltaspike.core.util.ArraysUtils;
-
-/**
- * <p>A WrappingBeanBuilder helps creating Beans which internally
- * just wrap another existing Bean. The Types, Qualifiers
- * and other attributes of the resulting Bean can be modified.</p>
- *
- * <p>The {@link Bean#create(javax.enterprise.context.spi.CreationalContext)}
- * and {@link Bean#destroy(Object, javax.enterprise.context.spi.CreationalContext)}
- * methods will get delegated to the underlying wrapped Bean.</p>
- *
- * @param <T> the type of the Bean
- */
-public class WrappingBeanBuilder<T>
-{
-    private final Bean<T> delegate;
-    private final BeanManager beanManager;
-
-    private Set<Type> types;
-    private Set<Annotation> qualifiers;
-    private String name;
-    private Class<? extends Annotation> scope;
-    private boolean alternative;
-    private boolean nullable;
-    private String toString;
-    private Set<Class<? extends Annotation>> stereotypes;
-    private boolean passivationCapable;
-    private String id;
-
-    /**
-     * Instantiate a new {@link WrappingBeanBuilder}.
-     *
-     * @param delegate    the delegate bean
-     * @param beanManager current bean-manager
-     */
-    public WrappingBeanBuilder(Bean<Object> delegate, BeanManager beanManager)
-    {
-        this.delegate = (Bean<T>)delegate;
-        this.beanManager = beanManager;
-    }
-
-    /**
-     * <p>
-     * Read the {@link AnnotatedType}, creating a narrowing bean from the class
-     * and its annotations.
-     * </p>
-     *
-     * @param type the type to read
-     */
-    public WrappingBeanBuilder<T> readFromType(AnnotatedType<T> type)
-    {
-        types = new HashSet<Type>(type.getTypeClosure());
-        qualifiers = new HashSet<Annotation>();
-        stereotypes = new HashSet<Class<? extends Annotation>>();
-        String name = null;
-        Class<? extends Annotation> scope = Dependent.class;
-
-        for (Annotation annotation : type.getAnnotations())
-        {
-            if (beanManager.isQualifier(annotation.annotationType()))
-            {
-                qualifiers.add(annotation);
-            }
-            else if (annotation.annotationType().equals(Named.class))
-            {
-                name = Named.class.cast(annotation).value();
-            }
-            else if (beanManager.isScope(annotation.annotationType()))
-            {
-                scope = annotation.annotationType();
-            }
-            else if (beanManager.isStereotype(annotation.annotationType()))
-            {
-                stereotypes.add(annotation.annotationType());
-            }
-        }
-        if (qualifiers.isEmpty())
-        {
-            qualifiers.add(new DefaultLiteral());
-        }
-        qualifiers.add(new AnyLiteral());
-        this.name = "".equals(name) ? null : name;
-        this.scope = scope;
-        alternative = type.isAnnotationPresent(Alternative.class);
-        return this;
-    }
-
-    /**
-     * Type closure currently defined for bean creation.
-     *
-     * @return the type closure currently defined
-     */
-    public Set<Type> getTypes()
-    {
-        return types;
-    }
-
-    /**
-     * Define the type closure used for bean creation.
-     *
-     * @param types the type closure to use
-     */
-    public WrappingBeanBuilder<T> types(Set<Type> types)
-    {
-        this.types = types;
-        return this;
-    }
-
-    /**
-     * Define the type closure used for bean creation.
-     *
-     * @param types the type closure to use
-     */
-    public WrappingBeanBuilder<T> types(Type... types)
-    {
-        this.types = ArraysUtils.asSet(types);
-        return this;
-    }
-
-    /**
-     * Add to the type closure used for bean creation.
-     *
-     * @param type additional type to use
-     */
-    public WrappingBeanBuilder<T> addType(Type type)
-    {
-        types.add(type);
-        return this;
-    }
-
-    /**
-     * Add to the type closure used for bean creation.
-     *
-     * @param types the additional types to use
-     */
-    public WrappingBeanBuilder<T> addTypes(Type... types)
-    {
-        this.types.addAll(ArraysUtils.asSet(types));
-        return this;
-    }
-
-    /**
-     * Add to the type closure used for bean creation.
-     *
-     * @param types the additional types to use
-     */
-    public WrappingBeanBuilder<T> addTypes(Collection<Type> types)
-    {
-        this.types.addAll(types);
-        return this;
-    }
-
-    /**
-     * Qualifiers currently defined for bean creation.
-     *
-     * @return the qualifiers current defined
-     */
-    public Set<Annotation> getQualifiers()
-    {
-        return qualifiers;
-    }
-
-    /**
-     * Define the qualifiers used for bean creation.
-     *
-     * @param qualifiers the qualifiers to use
-     */
-    public WrappingBeanBuilder<T> qualifiers(Set<Annotation> qualifiers)
-    {
-        this.qualifiers = qualifiers;
-        return this;
-    }
-
-    /**
-     * Define the qualifiers used for bean creation.
-     *
-     * @param qualifiers the qualifiers to use
-     */
-    public WrappingBeanBuilder<T> qualifiers(Annotation... qualifiers)
-    {
-        this.qualifiers = ArraysUtils.asSet(qualifiers);
-        return this;
-    }
-
-    /**
-     * Add to the qualifiers used for bean creation.
-     *
-     * @param qualifier the additional qualifier to use
-     */
-    public WrappingBeanBuilder<T> addQualifier(Annotation qualifier)
-    {
-        qualifiers.add(qualifier);
-        return this;
-    }
-
-    /**
-     * Add to the qualifiers used for bean creation.
-     *
-     * @param qualifiers the additional qualifiers to use
-     */
-    public WrappingBeanBuilder<T> addQualifiers(Annotation... qualifiers)
-    {
-        this.qualifiers.addAll(ArraysUtils.asSet(qualifiers));
-        return this;
-    }
-
-    /**
-     * Add to the qualifiers used for bean creation.
-     *
-     * @param qualifiers the additional qualifiers to use
-     */
-    public WrappingBeanBuilder<T> addQualifiers(
-            Collection<Annotation> qualifiers)
-    {
-        this.qualifiers.addAll(qualifiers);
-        return this;
-    }
-
-    /**
-     * The name of the bean currently defined for bean creation.
-     *
-     * @return the name of the bean or <code>null</code> if the bean has no name
-     */
-    public String getName()
-    {
-        return name;
-    }
-
-    /**
-     * Define the name of the bean used for bean creation.
-     *
-     * @param name the name of the bean to use or <code>null</code> if the bean
-     *             should have no name
-     */
-    public WrappingBeanBuilder<T> name(String name)
-    {
-        this.name = name;
-        return this;
-    }
-
-    /**
-     * Scope currently defined for bean creation.
-     *
-     * @return the scope currently defined
-     */
-    public Class<? extends Annotation> getScope()
-    {
-        return scope;
-    }
-
-    /**
-     * Define the scope used for bean creation.
-     *
-     * @param scope the scope to use
-     */
-    public WrappingBeanBuilder<T> scope(Class<? extends Annotation> scope)
-    {
-        this.scope = scope;
-        return this;
-    }
-
-    /**
-     * Whether the created bean will be an alternative.
-     *
-     * @return <code>true</code> if the created bean will be an alternative,
-     *         otherwise <code>false</code>
-     */
-    public boolean isAlternative()
-    {
-        return alternative;
-    }
-
-    /**
-     * Define that the created bean will (or will not) be an alternative.
-     *
-     * @param alternative <code>true</code> if the created bean should be an
-     *                    alternative, otherwise <code>false</code>
-     */
-    public WrappingBeanBuilder<T> alternative(boolean alternative)
-    {
-        this.alternative = alternative;
-        return this;
-    }
-
-    /**
-     * Stereotypes currently defined for bean creation.
-     *
-     * @return the stereotypes currently defined
-     */
-    public Set<Class<? extends Annotation>> getStereotypes()
-    {
-        return stereotypes;
-    }
-
-    /**
-     * Define the stereotypes used for bean creation.
-     *
-     * @param stereotypes the stereotypes to use
-     */
-    public WrappingBeanBuilder<T> stereotypes(
-            Set<Class<? extends Annotation>> stereotypes)
-    {
-        this.stereotypes = stereotypes;
-        return this;
-    }
-
-    /**
-     * <p>
-     * Use the bean builder's current state to define the bean.
-     * </p>
-     *
-     * @return the bean
-     */
-    public ImmutableBeanWrapper<T> create()
-    {
-        if (isPassivationCapable())
-        {
-            return new ImmutablePassivationCapableBeanWrapper<T>(delegate,
-                    name, qualifiers, scope, stereotypes, types, alternative,
-                    nullable, toString, id);
-        }
-        else
-        {
-            return new ImmutableBeanWrapper<T>(delegate, name, qualifiers, scope,
-                    stereotypes, types, alternative, nullable, toString);
-        }
-    }
-
-    // }
-
-    /**
-     * The string used when {@link #toString()} is called on the bean.
-     *
-     * @return the string currently defined
-     */
-    public String getToString()
-    {
-        return toString;
-    }
-
-    /**
-     * Define the string used when {@link #toString()} is called on the bean.
-     *
-     * @param toString the string to use
-     */
-    public WrappingBeanBuilder<T> toString(String toString)
-    {
-        this.toString = toString;
-        return this;
-    }
-
-    /**
-     * Whether the created bean will be nullable.
-     *
-     * @return <code>true</code> if the created bean will be nullable, otherwise
-     *         <code>false</code>
-     */
-    public boolean isNullable()
-    {
-        return nullable;
-    }
-
-    /**
-     * Define that the created bean will (or will not) be nullable.
-     *
-     * @param nullable <code>true</code> if the created bean should be nullable,
-     *                 otherwise <code>false</code>
-     */
-    public WrappingBeanBuilder<T> nullable(boolean nullable)
-    {
-        this.nullable = nullable;
-        return this;
-    }
-
-    /**
-     * Whether the created bean will be passivation capable.
-     *
-     * @return <code>true</code> if the created bean will be passivation
-     *         capable, otherwise <code>false</code>
-     */
-    public boolean isPassivationCapable()
-    {
-        return passivationCapable;
-    }
-
-    /**
-     * Define that the created bean will (or will not) be passivation capable.
-     *
-     * @param passivationCapable <code>true</code> if the created bean should be passivation
-     *                           capable, otherwise <code>false</code>
-     */
-    public WrappingBeanBuilder<T> passivationCapable(boolean passivationCapable)
-    {
-        this.passivationCapable = passivationCapable;
-        return this;
-    }
-
-    /**
-     * The id currently defined for bean creation.
-     *
-     * @return the id currently defined.
-     */
-    public String getId()
-    {
-        return id;
-    }
-
-    /**
-     * Define the id used for bean creation.
-     *
-     * @param id the id to use
-     */
-    public WrappingBeanBuilder<T> id(String id)
-    {
-        this.id = id;
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bc187acb/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java
index f241cd2..7be398e 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java
@@ -41,7 +41,7 @@ import org.apache.deltaspike.core.api.message.Message;
 import org.apache.deltaspike.core.api.message.MessageContext;
 import org.apache.deltaspike.core.api.message.annotation.MessageBundle;
 import org.apache.deltaspike.core.api.message.annotation.MessageTemplate;
-import org.apache.deltaspike.core.util.builder.WrappingBeanBuilder;
+import org.apache.deltaspike.core.util.bean.WrappingBeanBuilder;
 import org.apache.deltaspike.core.spi.activation.Deactivatable;
 import org.apache.deltaspike.core.util.ClassDeactivationUtils;