Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.DefinitionException


        {
            throw new DeploymentException(e);
        }
        catch (IllegalArgumentException e)
        {
            throw new DefinitionException(e);
        }
        catch (Exception e)
        {
            throw ExceptionUtil.throwAsRuntimeException(e);
        }
View Full Code Here


    {
        for (Decorator decorator : webBeansContext.getDecoratorsManager().getDecorators())
        {
            if (decorator.getDecoratedTypes().isEmpty())
            {
                throw new DefinitionException("Decorator must implement at least one interface (java.io.Serializeable will be ignored)");
            }

        }
    }
View Full Code Here

                        if (pt1.getRawType() == pt2.getRawType())
                        {
                            if (!GenericsUtil.isAssignableFrom(true, false, pt1, pt2))
                            {
                                throw new DefinitionException("Generic error matching " + api + " and " + t);
                            }
                        }
                    }
                }
            }
View Full Code Here

                    break;
                }
            }
            if (!found)
            {
                throw new DefinitionException("Decorators must have a one @Delegate injection point. " +
                        "But the decorator bean : " + managedBean.toString() + " has more than one");
            }

            webBeansContext.getDecoratorsManager().addDecorator((Decorator<?>) bean);
            webBeansContext.getDecoratorsManager().addCustomDecoratorClass(bean.getBeanClass());
View Full Code Here

        if(hasName)
        {
            if(AnnotationUtil.hasMethodAnnotation(method, Named.class))
            {
                throw new DefinitionException("Specialized method : " + method.getName() + " in class : "
                        + component.getReturnType().getName() + " may not define @Named annotation");
            }
        }

        return hasName;
View Full Code Here

    private BeanArchiveInformation readBeansXml(URL beansXmlUrl, String beansXmlLocation)
    {
        if (beansXmlUrl == null)
        {
            throw new DefinitionException("beans.xml URL must be given!");
        }

        if (!beansXmlLocation.endsWith(".xml"))
        {
            // handle jars without beans.xml file
View Full Code Here

            {
                withAnnotations = withAnnotationsAnn.value();
            }
            else
            {
                throw new DefinitionException("WithAnnotations must only be used for ProcessAnnotatedType");
            }
        }
        else
        {
            withAnnotations = null;
View Full Code Here

        {
            WildcardType wildcardType = (WildcardType)type;
            Type[] bounds = wildcardType.getUpperBounds();
            if (bounds.length > 1)
            {
                throw new DefinitionException("Illegal use of wild card type with more than one upper bound: " + wildcardType);
            }
            else if (bounds.length == 0)
            {
                return Object.class;
            }
            else
            {
                return getClass(bounds[0]);
            }
        }
        else if (type instanceof TypeVariable)
        {
            TypeVariable<?> typeVariable = (TypeVariable<?>)type;
            if (typeVariable.getBounds().length > 1)
            {
                throw new DefinitionException("Illegal use of type variable with more than one bound: " + typeVariable);
            }
            else
            {
                Type[] bounds = typeVariable.getBounds();
                if (bounds.length == 0)
                {
                    return Object.class;
                }
                else
                {
                    return getClass(bounds[0]);
                }
            }
        }
        else
        {
            throw new DefinitionException("Unsupported type " + type);
        }
    }
View Full Code Here

     */
    private void validateInjectionPointType(Type injectionPointType)
    {
        if (injectionPointType instanceof TypeVariable || injectionPointType instanceof WildcardType || injectionPointType instanceof GenericArrayType)
        {
            throw new DefinitionException("Injection point cannot define Type Variable " + injectionPointType);
        }

        if (!(injectionPointType instanceof Class) &&
            !(injectionPointType instanceof ParameterizedType))
        {
View Full Code Here

    public void validate() throws DefinitionException
    {
        Type type = annotatedMember.getBaseType();
        if (type instanceof GenericArrayType)
        {
            throw new DefinitionException("Produced Type must not be a GenericArrayType");
        }
        else if (ClassUtil.isParametrizedType(type))
        {
            if (GenericsUtil.containsWildcardType(type))
            {
                throw new DefinitionException("Produced type must not be a WildcardType");
            }
            else if (!Dependent.class.equals(beanAttributes.getScope()))
            {

                ParameterizedType parameterizedType = GenericsUtil.getParameterizedType(type);
                if (GenericsUtil.containTypeVariable(parameterizedType.getActualTypeArguments()))
                {
                    throw new DefinitionException("Produced ParametrizedType must be @Dependent-Scope");
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.enterprise.inject.spi.DefinitionException

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.