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


    {
        violationMessage.addLine("found beans: ");

        addBeanInfo(beans, violationMessage);

        throw new AmbiguousResolutionException(violationMessage.toString());
    }
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 @Alternative and <alternatives> tags to choose a precedence.  Beans:{0}\nfor {1}",
                                                listToLines(matchBeans), this));
  }
View Full Code Here

    {
        violationMessage.addLine("found beans: ");

        addBeanInfo(beans, violationMessage);

        throw new AmbiguousResolutionException(violationMessage.toString());
    }
View Full Code Here

            }
        }

        // multiple templating engines found
        if (instance.isAmbiguous()) {
            throw new AmbiguousResolutionException("Multiple TemplatingProviders found on classpath. Select the prefered one.");
        }

        provider = instance.get();
    }
View Full Code Here

            throw new ResolutionException("cannot find beans for class " + type.getCanonicalName());
        }

        if (beans.size() > 1)
        {
            throw new AmbiguousResolutionException("cannot find beans for class " + type.getCanonicalName());
        }

        @SuppressWarnings("unchecked")
        Bean<T> bean = (Bean<T>)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() + " with qualifiers : " + qualifierMessage);
        }

        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 = (AbstractOwbBean<?>) set.iterator().next();

        object = getInstance(component, creationalContext);
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

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.