Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.DefinitionException


                        manager.addObserver(processedObserver);
                    }
                }
            }
        } catch (Exception e) {
            throw new DefinitionException(e);
        }
    }
View Full Code Here


        }
        if (isFragmentFound(DEPLOYMENT_EXCEPTION_FRAGMENTS, root)) {
            return new DeploymentException(root);
        }
        if (isFragmentFound(DEFINITION_EXCEPTION_FRAGMENTS, root)) {
            return new DefinitionException(root);
        }
        return throwable;
    }
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

       
        if(annotatedMethod.isAnnotationPresent(Inject.class)
            || AnnotationUtil.hasAnnotatedMethodParameterAnnotation(annotatedMethod, Observes.class)
            || annotatedMethod.isAnnotationPresent(Produces.class))
        {
            throw new DefinitionException("Error in definining disposal method of annotated method : " + annotatedMethod
                    + ". Disposal methods  can not be annotated with" + " @Initializer/@Destructor/@Produces annotation or has a parameter annotated with @Observes.");
        }

        for (AnnotatedParameter param : annotatedMethod.getParameters())
        {
            if (param.getBaseType().equals(InjectionPoint.class))
            {
                throw new DefinitionException("Error in definining disposal method of annotated method : " + annotatedMethod
                    + ". Disposal methods must not have an InjectionPoint.");
            }
        }
    }
View Full Code Here

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

    private <T> BeanAttributes<T> updateBeanAttributesIfNeeded(BeanAttributes<T> beanAttributes, ProcessBeanAttributesImpl event)
    {
        if (event.getDefinitionError() != null)
        {
            throw new DefinitionException(event.getDefinitionError());
        }
        if (event.getAttributes() != beanAttributes)
        {
            beanAttributes = event.getAttributes();
            if (!webBeansContext.getBeanManagerImpl().isScope(beanAttributes.getScope()))
            {
                throw new DefinitionException(beanAttributes.getScope() + " is not a scope");
            }
        }
        return beanAttributes;
    }
View Full Code Here

        {
            webBeansContext.getBeanManagerImpl().fireEvent(event, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
        }
        catch (final Exception e)
        {
            throw new DefinitionException("event ProcessBeanAttributes thrown an exception for " + annotatedType, e);
        }
        return event;
    }
View Full Code Here

                do
                {
                    Class<? super C> superclass = annotatedToSpecialize.getJavaClass().getSuperclass();
                    if (superclass.equals(Object.class))
                    {
                        throw new DefinitionException("@Specialized Class : " + getAnnotated().getJavaClass().getName()
                                + " must not directly extend Object.class");
                    }
                    annotatedToSpecialize = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(superclass);
                } while(annotatedToSpecialize.getAnnotation(Specializes.class) != null);


                defineName(annotatedToSpecialize, WebBeansUtil.getManagedBeanDefaultName(annotatedToSpecialize.getJavaClass().getSimpleName()));
            }
            if (name == null)
            {
                defineName(getAnnotated(), WebBeansUtil.getManagedBeanDefaultName(getAnnotated().getJavaClass().getSimpleName()));
            }
            else
            {
                // TODO XXX We have to check stereotypes here, too
                if (getAnnotated().getJavaClass().isAnnotationPresent(Named.class))
                {
                    throw new DefinitionException("@Specialized Class : " + getAnnotated().getJavaClass().getName()
                            + " may not explicitly declare a bean name");
                }
            }
        }
View Full Code Here

            else
            {
                // TODO XXX We have to check stereotypes here, too
                if (getAnnotated().isAnnotationPresent(Named.class))
                {
                    throw new DefinitionException("@Specialized Producer method : " + getAnnotated().getJavaMember().getName()
                            + " may not explicitly declare a bean name");
                }
            }
        }
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.