Package java.lang.annotation

Examples of java.lang.annotation.Annotation


        Class clz = classLoader.loadClass("com.mypizzaco.pizza.PizzaPortType");

        Method meths[] = clz.getMethods();
        for (Method m : meths) {
            if ("orderPizzaBroken".equals(m.getName())) {
                Annotation annotations[][] = m.getParameterAnnotations();
                assertEquals(1, annotations.length);
                for (int i = 0; i < 1; i++) {
                    assertTrue(annotations[i][0] instanceof WebParam);
                    WebParam parm = (WebParam)annotations[i][0];
                    if ("OrderPizza".equals(parm.name())) {
View Full Code Here


        Class clz = classLoader.loadClass("org.apache.cxf.pizza_wrapped.Pizza");

        Method meths[] = clz.getMethods();
        for (Method m : meths) {
            if ("orderPizza".equals(m.getName())) {
                Annotation annotations[][] = m.getParameterAnnotations();
                assertEquals(2, annotations.length);
                for (int i = 0; i < 2; i++) {
                    assertTrue(annotations[i][0] instanceof WebParam);
                    WebParam parm = (WebParam)annotations[i][0];
                    if ("Toppings".equals(parm.name())) {
View Full Code Here

        Class cls = classLoader.loadClass("org.apache.header_test.rpc.TestRPCHeader");

        Method meths[] = cls.getMethods();
        for (Method m : meths) {
            if ("testHeader1".equals(m.getName())) {
                Annotation annotations[][] = m.getParameterAnnotations();
                assertEquals(2, annotations.length);
                assertEquals(1, annotations[1].length);
                assertTrue(annotations[1][0] instanceof WebParam);
                WebParam parm = (WebParam)annotations[1][0];
                assertEquals("http://apache.org/header_test/rpc/types", parm.targetNamespace());
                assertEquals("inHeader", parm.partName());
                assertEquals("headerMessage", parm.name());
                assertTrue(parm.header());
            }
        }

        for (Method m : meths) {
            if ("testInOutHeader".equals(m.getName())) {
                Annotation annotations[][] = m.getParameterAnnotations();
                assertEquals(2, annotations.length);
                assertEquals(1, annotations[1].length);
                assertTrue(annotations[1][0] instanceof WebParam);
                WebParam parm = (WebParam)annotations[1][0];
                assertEquals("http://apache.org/header_test/rpc/types", parm.targetNamespace());
View Full Code Here

    Type[] paramTypes = method.getGenericParameterTypes();
    Annotation[][] annotations = method.getParameterAnnotations();
    for (int i = 0; i < paramTypes.length; i++) {
      Schema paramSchema = getSchema(paramTypes[i], names);
      for (int j = 0; j < annotations[i].length; j++) {
        Annotation annotation = annotations[i][j];
        if (annotation instanceof AvroSchema)     // explicit schema
          paramSchema = Schema.parse(((AvroSchema)annotation).value());
        else if (annotation instanceof Union)     // union
          paramSchema = getAnnotatedUnion(((Union)annotation), names);
        else if (annotation instanceof Nullable// nullable
View Full Code Here

        private void applyOn(ConstraintValidation<?> composite) {
            // Update the attributes
            composite.getAttributes().putAll(values);

            // And the annotation
            Annotation originalAnnot = composite.getAnnotation();
            AnnotationProxyBuilder<Annotation> apb = new AnnotationProxyBuilder<Annotation>(originalAnnot);
            for ( String key : values.keySet() ) {
                apb.putValue(key, values.get(key));
            }
            Annotation newAnnot = apb.createAnnotation();
            ((ConstraintValidation<Annotation>) composite).setAnnotation(newAnnot);
        }
View Full Code Here

                    if (t == jta) {
                        found = true;
                    }
                }
                if (!found) {
                    Annotation tmp[] = new Annotation[anns.length + 1];
                    System.arraycopy(anns, 0, tmp, 0, anns.length);
                    tmp[anns.length] = jta;
                    anns = tmp;
                }
            }
View Full Code Here

    public void setServiceClass(Class<?> serviceClass) {
        this.serviceClass = serviceClass;
        checkServiceClassAnnotations(serviceClass);
    }
    protected void checkServiceClassAnnotations(Class<?> sc) {
        Annotation anns[] = serviceClass.getAnnotations();
        if (anns != null) {
            for (Annotation ann : anns) {
                String pkg = ann.annotationType().getPackage().getName();
                if ("javax.xml.ws".equals(pkg)
                    || "javax.jws".equals(pkg)) {
View Full Code Here

                        if (t == jta) {
                            found = true;
                        }
                    }
                    if (!found) {
                        Annotation tmp[] = new Annotation[anns.length + 1];
                        System.arraycopy(anns, 0, tmp, 0, anns.length);
                        tmp[anns.length] = jta;
                        anns = tmp;
                    }
                }
View Full Code Here

        }
        if (parameter >= annotations.length) {
            return null;
        } else {
            for (int i = 0; i < annotations[parameter].length; i++) {
                Annotation annotation = annotations[parameter][i];
                // With the ibm jdk, the condition:
                // if (annotation.annotationType().equals(WebParam.class)) {
                // SOMETIMES returns false even when the annotation type
                // is a WebParam.  Doing an instanceof check or using the
                // == operator seems to give the desired result.
View Full Code Here

        if ( transientAnn != null ) {
          annotationList.add( transientAnn );
        }
        else {
          if ( defaults.canUseJavaAnnotations() ) {
            Annotation annotation = getJavaAnnotation( Access.class );
            addIfNotNull( annotationList, annotation );
          }
          getId( annotationList, defaults );
          getEmbeddedId( annotationList, defaults );
          getEmbedded( annotationList, defaults );
View Full Code Here

TOP

Related Classes of java.lang.annotation.Annotation

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.