[weld-commits] Weld SVN: r6757 - extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Thu Jul 22 17:42:15 EDT 2010
Author: pete.muir at jboss.org
Date: 2010-07-22 17:42:15 -0400 (Thu, 22 Jul 2010)
New Revision: 6757
Removed:
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/AmbiguousBeanException.java
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanNotFoundException.java
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolutionException.java
extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java
Log:
remove BeanResolver
Deleted: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/AmbiguousBeanException.java
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/AmbiguousBeanException.java 2010-07-22 20:18:23 UTC (rev 6756)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/AmbiguousBeanException.java 2010-07-22 21:42:15 UTC (rev 6757)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.weld.extensions.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.Bean;
-
-/**
- * Exception thrown when more than 1 beans with the given type and qualifiers
- * could be found
- *
- * @author Stuart Douglas
- *
- */
-public class AmbiguousBeanException extends BeanResolutionException
-{
-
- private static final long serialVersionUID = -6513493477765900752L;
-
- public AmbiguousBeanException(Type type, Annotation[] qualifiers, Set<Bean<?>> beans)
- {
- super(type, qualifiers, "More than one bean found with type " + type + "and qualifiers. Bean found: " + beans);
- }
-
-}
Deleted: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanNotFoundException.java
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanNotFoundException.java 2010-07-22 20:18:23 UTC (rev 6756)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanNotFoundException.java 2010-07-22 21:42:15 UTC (rev 6757)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.weld.extensions.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-/**
- * Exception thrown when no beans with the given type and qualifiers could be
- * found
- *
- * @author Stuart Douglas
- *
- */
-public class BeanNotFoundException extends BeanResolutionException
-{
-
- private static final long serialVersionUID = -6513493477765900752L;
-
- public BeanNotFoundException(Type type, Annotation[] qualifiers)
- {
- super(type, qualifiers, "No bean found with type " + type + "and qualifiers " + qualifiers);
-
- }
-
-}
Deleted: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolutionException.java
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolutionException.java 2010-07-22 20:18:23 UTC (rev 6756)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolutionException.java 2010-07-22 21:42:15 UTC (rev 6757)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.weld.extensions.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-/**
- * Superclass for exceptions that result from bean lookup
- *
- * @author Stuart Douglas
- *
- */
-public class BeanResolutionException extends Exception
-{
- private static final long serialVersionUID = -4376259139316630962L;
- private final Type type;
- private final Annotation[] qualifiers;
-
- public BeanResolutionException(Type type, Annotation[] qualifiers, String message)
- {
- this.type = type;
- this.qualifiers = qualifiers;
- }
-
- public Type getType()
- {
- return type;
- }
-
- public Annotation[] getQualifiers()
- {
- return qualifiers;
- }
-
-}
Deleted: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java 2010-07-22 20:18:23 UTC (rev 6756)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/BeanResolver.java 2010-07-22 21:42:15 UTC (rev 6757)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.weld.extensions.util;
-
-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;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.jboss.weld.extensions.literal.DefaultLiteral;
-
-/**
- * Utility class to resolve and acquire references to Beans
- *
- * @author Stuart Douglas
- *
- */
-public class BeanResolver
-{
- private BeanResolver()
- {
- }
-
- /**
- * Resolves a bean
- *
- */
- public static Bean<?> resolveBean(Type beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanNotFoundException
- {
- Set<Bean<?>> beans = manager.getBeans(beanType, qualifiers);
- if (beans.size() == 0)
- {
- throw new BeanNotFoundException(beanType, qualifiers);
- }
- if (beans.size() != 1)
- {
- throw new AmbiguousBeanException(beanType, qualifiers, beans);
- }
- return beans.iterator().next();
- }
-
- /**
- * Resolves a bean with the qualifier @Default
- *
- */
- public static Bean<?> resolveDefaultBean(Type beanType, BeanManager manager) throws AmbiguousBeanException, BeanNotFoundException
- {
- Annotation[] qualifiers = new Annotation[1];
- qualifiers[0] = DefaultLiteral.INSTANCE;
- Set<Bean<?>> beans = manager.getBeans(beanType, qualifiers);
- if (beans.size() == 0)
- {
- throw new BeanNotFoundException(beanType, qualifiers);
- }
- if (beans.size() != 1)
- {
- throw new AmbiguousBeanException(beanType, qualifiers, beans);
- }
- return beans.iterator().next();
- }
-
- /**
- * gets a reference to a bean with the given type and qualifiers
- */
- public static Object getReference(Type beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanNotFoundException
- {
- Bean<?> bean = resolveBean(beanType, manager, qualifiers);
- CreationalContext<?> context = manager.createCreationalContext(bean);
- return manager.getReference(bean, beanType, context);
- }
-
- /**
- * gets a reference to a bean with the given type and qualifiers
- */
- public static <T> T getReference(Class<T> beanType, BeanManager manager, Annotation... qualifiers) throws AmbiguousBeanException, BeanNotFoundException
- {
- return (T) getReference((Type) beanType, manager, qualifiers);
- }
-
- /**
- * gets a reference to a bean with the given type and qualifier @Default
- */
- public static Object getDefaultReference(Type beanType, BeanManager manager) throws AmbiguousBeanException, BeanNotFoundException
- {
- Bean<?> bean = resolveDefaultBean(beanType, manager);
- CreationalContext<?> context = manager.createCreationalContext(bean);
- return manager.getReference(bean, beanType, context);
- }
-
- /**
- * gets a reference to a bean with the given type and qualifier @Default
- */
- public static <T> T getDefaultReference(Class<T> beanType, BeanManager manager) throws AmbiguousBeanException, BeanNotFoundException
- {
- return (T) getDefaultReference((Type) beanType, manager);
- }
-
-}
More information about the weld-commits
mailing list