Package javax.enterprise.inject

Examples of javax.enterprise.inject.AmbiguousResolutionException


    private <T> Bean<T> resolveUniqueBean(Type type, Set<Bean<T>> beans) {
        if (beans.size() == 0) {
            throw new UnsatisfiedResolutionException("Unable to resolve any beans of " + type);
        } else if (beans.size() > 1) {
            throw new AmbiguousResolutionException("More than one bean available (" + beans + ")");
        }
        return beans.iterator().next();
    }
View Full Code Here


            throw new UnsatisfiedResolutionException(message.toString());
        }

        if (resolvedSet.size() > 1)
        {
            throw new AmbiguousResolutionException("There is more than one api type with : " + type.getName());
        }

        Bean<?> bean = resolvedSet.iterator().next();
        WebBeansUtil.checkUnproxiableApiType(bean, bean.getScope());
View Full Code Here

            return null;
        }

        if (set.size() > 1)
        {
            throw new AmbiguousResolutionException("There are more than one WebBeans with name : " + name);
        }

        component = (AbstractBean<?>) set.iterator().next();

        object = getInstance(component);
View Full Code Here

            set = this.injectionResolver.findBySpecialization(set);
        }
       
        if(set.size() > 0 && set.size() > 1)
        {
            throw new AmbiguousResolutionException("Ambigious resolution");
        }
       
        return (Bean<? extends X>)set.iterator().next();
    }
View Full Code Here

    if (!ambiguous.isEmpty()) {
      ambiguous.add(selected);

      String message = getExceptionMessage(type, ambiguous);
      throw new DemoiselleException(message, new AmbiguousResolutionException());
    }
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  private static <T> T getReference(Set<Bean<?>> beans, Class<T> beanClass, Annotation... qualifiers) {
    if (beans.size() > 1) {
      String message = getBundle().getString("ambiguous-bean-resolution", beanClass.getName(), beans.toString());
      throw new DemoiselleException(message, new AmbiguousResolutionException());
    }

    Bean<?> bean = beans.iterator().next();
    CreationalContext<?> context = getBeanManager().createCreationalContext(bean);
    Type beanType = beanClass == null ? bean.getBeanClass() : beanClass;
View Full Code Here

      if (priority == bestPriority)
        matchBeans.add(bean);
    }

    return new AmbiguousResolutionException(L.l("Too many beans match, because they all have equal precedence.  See the @Stereotype and <enable> tags to choose a precedence.  Beans:{0}",
                                                listToLines(matchBeans)));
  }
View Full Code Here

      }
      else {
        return getReferenceFactory(ij);
      }
    } catch (AmbiguousResolutionException e) {
      throw new AmbiguousResolutionException(L.l("{0}.{1}: {2}",
                                       ij.getMember().getDeclaringClass().getName(),
                                       ij.getMember().getName(),
                                       e.getMessage()),
                                   e);
    } catch (UnsatisfiedResolutionException e) {
View Full Code Here

      if (priority == bestPriority)
        matchBeans.add(bean);
    }

    return new AmbiguousResolutionException(L.l("Too many beans match, because they all have equal precedence.  See the @Stereotype and <enable> tags to choose a precedence.  Beans:{0}\nfor {1}",
                                                listToLines(matchBeans), this));
  }
View Full Code Here

      try {
        _fieldFactory = beanManager.getReferenceFactory(_ip);
      } catch (AmbiguousResolutionException e) {
        String loc = getLocation(_field);
       
        throw new AmbiguousResolutionException(loc + e.getMessage(), e);
      } catch (UnsatisfiedResolutionException e) {
        String loc = getLocation(_field);
       
        throw new UnsatisfiedResolutionException(loc + e.getMessage(), e);
      } catch (IllegalProductException e) {
View Full Code Here

TOP

Related Classes of javax.enterprise.inject.AmbiguousResolutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.