Package java.lang.annotation

Examples of java.lang.annotation.Target


                    defaultDeploymentType = defaultAnn;
                    deploymentTypeFound = true;
                }
                else if (AnnotationUtil.isInterceptorBindingAnnotation(annClazz))
                {
                    Target target = clazz.getAnnotation(Target.class);
                    ElementType[] type = target.value();

                    if (type.length != 1 && !type[0].equals(ElementType.TYPE))
                    {
                        throw new WebBeansConfigurationException(errorMessage + "Stereotype with @InterceptorBindingType must be defined as @Target{TYPE}");
                    }

                    interceptorBindingTypes.add(XMLUtil.getXMLDefinedAnnotationMember(child, annClazz, errorMessage));
                }
                else if (clazz.equals(Named.class))
                {
                    defaultName = defaultAnn;
                    Named name = (Named) defaultName;
                    if (!name.value().equals(""))
                    {
                        throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not define @Named annotation with value");
                    }
                }
                else if (AnnotationUtil.isBindingAnnotation(annClazz))
                {
                    throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not define @BindingType annotation");
                }

                else if (AnnotationUtil.isStereoTypeAnnotation(annClazz))
                {
                    Target innerStereo = clazz.getAnnotation(Target.class);
                    Class<?> outerStereoClass = XMLUtil.getElementJavaType(stereoTypeDecleration);
                    Target outerStereo = outerStereoClass.getAnnotation(Target.class);

                    ElementType[] innerValues = innerStereo.value();
                    ElementType[] outerValues = outerStereo.value();

                    for (ElementType innerValue : innerValues)
                    {
                        if (innerValue.equals(ElementType.METHOD) || innerValue.equals(ElementType.FIELD))
                        {
View Full Code Here


        if (AnnotationUtil.hasStereoTypeMetaAnnotation(annotations))
        {
            Annotation[] isy = AnnotationUtil.getStereotypeMetaAnnotations(annotations);

            Target outerStereo = clazz.getAnnotation(Target.class);
            for (Annotation is : isy)
            {
                Target innerStereo = is.annotationType().getAnnotation(Target.class);

                ElementType[] innerValues = innerStereo.value();
                ElementType[] outerValues = outerStereo.value();

                for (ElementType innerValue : innerValues)
                {
                    if (innerValue.equals(ElementType.METHOD) || innerValue.equals(ElementType.FIELD))
View Full Code Here

                defaultScopeType = defaultAnn;
                scopeTypeFound = true;
            }               
            else if (AnnotationUtil.isInterceptorBindingAnnotation(annClazz))
            {
                Target target = clazz.getAnnotation(Target.class);
                ElementType[] type = target.value();

                if (type.length != 1 && !type[0].equals(ElementType.TYPE))
                {
                    throw new WebBeansConfigurationException(errorMessage + "Stereotype with @InterceptorBinding must be defined as @Target{TYPE}");
                }

                interceptorBindingTypes.add(XMLUtil.getXMLDefinedAnnotationMember(child, annClazz, errorMessage));
            }
            else if (clazz.equals(Named.class))
            {
                defaultName = defaultAnn;
                Named name = (Named) defaultName;
                if (!name.value().equals(""))
                {
                    throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not define @Named annotation with value");
                }
            }
            else if (AnnotationUtil.isQualifierAnnotation(annClazz))
            {
                throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not define @Qualifier annotation");
            }

            else if (AnnotationUtil.isStereoTypeAnnotation(annClazz))
            {
                Target innerStereo = clazz.getAnnotation(Target.class);
                Class<?> outerStereoClass = XMLUtil.getElementJavaType(stereoTypeDecleration);
                Target outerStereo = outerStereoClass.getAnnotation(Target.class);

                ElementType[] innerValues = innerStereo.value();
                ElementType[] outerValues = outerStereo.value();

                for (ElementType innerValue : innerValues)
                {
                    if (innerValue.equals(ElementType.METHOD) || innerValue.equals(ElementType.FIELD))
                    {
View Full Code Here

        {
            Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(annots);

            for (Annotation annotation : anns)
            {
                Target target = annotation.annotationType().getAnnotation(Target.class);
                ElementType[] elementTypes = target.value();

                if (!(elementTypes.length == 1 && elementTypes[0].equals(ElementType.TYPE)))
                {
                    throw new WebBeansConfigurationException(errorMessage);
                }
View Full Code Here

        {
            Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(annots);

            for (Annotation annotation : anns)
            {
                Target target = annotation.annotationType().getAnnotation(Target.class);
                ElementType[] elementTypes = target.value();

                if (!(elementTypes.length == 1 && elementTypes[0].equals(ElementType.TYPE)))
                {
                    throw new WebBeansConfigurationException(errorMessage);
                }
View Full Code Here

                            "annotation with value");
                }
            }
            else if (AnnotationUtil.isInterceptorBindingAnnotation(annotType))
            {
                Target target = clazz.getAnnotation(Target.class);
                ElementType[] type = target.value();

                if (type.length != 1 && !type[0].equals(ElementType.TYPE))
                {
                    throw new WebBeansConfigurationException("Stereotype with @InterceptorBinding must be " +
                            "defined as @Target{TYPE}");
View Full Code Here

        String fullName();
    }
    public static boolean isJAXB22() {
        Target t = XmlElement.class.getAnnotation(Target.class);
        //JAXB 2.2 allows XmlElement on params.
        for (ElementType et : t.value()) {
            if (et == ElementType.PARAMETER) {
                return true;
            }
        }
        return false;
View Full Code Here

    /**
     * Restrict to the supported {@link ElementType}(s) of the annotation (use the @Target, if provided).
     * @param annotationType annotation to explore
     */
    public static Predicate onlySupportedElements(final Class<? extends Annotation> annotationType) {
        Target target = annotationType.getAnnotation(Target.class);
        if (target == null) {
            return alwaysTrue();
        }

        Collection<Predicate> supportedTypes = new HashSet<Predicate>();
        for (ElementType type : target.value()) {
            supportedTypes.add(on(type));
        }

        return or(supportedTypes);
    }
View Full Code Here

        String fullName();
    }
    public static boolean isJAXB22() {
        Target t = XmlElement.class.getAnnotation(Target.class);
        //JAXB 2.2 allows XmlElement on params.
        for (ElementType et : t.value()) {
            if (et == ElementType.PARAMETER) {
                return true;
            }
        }
        return false;
View Full Code Here

        String fullName();
    }
    public static boolean isJAXB22() {
        Target t = XmlElement.class.getAnnotation(Target.class);
        //JAXB 2.2 allows XmlElement on params.
        for (ElementType et : t.value()) {
            if (et == ElementType.PARAMETER) {
                return true;
            }
        }
        return false;
View Full Code Here

TOP

Related Classes of java.lang.annotation.Target

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.