Package java.lang.annotation

Examples of java.lang.annotation.Annotation.annotationType()


                for (int i = 0; i < annotations.length; i++) {
                    Annotation nextAnnotation = annotations[i];
                    if (nextAnnotation != null && !(nextAnnotation instanceof XmlElement) && !(nextAnnotation instanceof XmlJavaTypeAdapter)) {
                        String annotationClassName = nextAnnotation.annotationType().getName();
                        AnnotationVisitor av = fv.visitAnnotation(L + annotationClassName.replace(DOT_CHR, SLASH_CHR) + SEMI_COLON, true);
                        for (Method next : nextAnnotation.annotationType().getDeclaredMethods()) {
                            try {
                                Object nextValue = next.invoke(nextAnnotation, new Object[] {});
                                if (nextValue instanceof Class) {
                                    Type nextType = Type.getType(L + ((Class) nextValue).getName().replace(DOT_CHR, SLASH_CHR) + SEMI_COLON);
                                    nextValue = nextType;
View Full Code Here


      if (annotations != null && annotations.length > 0)
      {
         for (Object annObject : annotations)
         {
            Annotation annotation = Annotation.class.cast(annObject);
            env.putAnnotation(annotation.annotationType(), type, resource.getClassName(), signature);
         }
      }
   }

   /**
 
View Full Code Here

            //and if so throw a more informative error message
            boolean wrongAnnotation = false;
            for (int i = 0; i < method.getParameterAnnotations().length; ++i) {
                for (int j = 0; j < method.getParameterAnnotations()[i].length; ++j) {
                    Annotation annotation = method.getParameterAnnotations()[i][j];
                    if (annotation.annotationType().getName().equals("javax.ws.rs.PathParam")) {
                        wrongAnnotation = true;
                    }
                }
            }
            if (wrongAnnotation) {
View Full Code Here

        for (BoundMethod binding : bindings) {
            Annotation classifer = parameter.getClassifier();
            Type type = parameter.getType();
           
            if (binding.classifier != null) {
                if (classifer != null && classifer.annotationType().equals(binding.classifier)) {
                    if (binding.type == null || binding.type.equals(type)) {
                        return binding;
                    }
                }
            } else if (binding.type.equals(type)) {
View Full Code Here

         if (a instanceof Named)
         {
            named = (Named)a;
            break;
         }
         else if (a.annotationType().isAnnotationPresent(Qualifier.class))
         {
            qualifier = a.annotationType();
            break;
         }
      }
View Full Code Here

            named = (Named)a;
            break;
         }
         else if (a.annotationType().isAnnotationPresent(Qualifier.class))
         {
            qualifier = a.annotationType();
            break;
         }
      }
      if (type.isInterface() && type.equals(Provider.class))
      {
View Full Code Here

            }
            catch (Exception e)
            {

               String msg = "Not able resolve method parameter " + mp;
               Class<?> ac = a.annotationType();
               if (ac == MatrixParam.class || ac == QueryParam.class || ac == PathParam.class)
               {
                  throw new WebApplicationException(e, Response.status(Response.Status.NOT_FOUND).entity(msg).type(
                     MediaType.TEXT_PLAIN).build());
               }
View Full Code Here

               p[i] = pr.resolve(cp, context);
            }
            catch (Exception e)
            {
               String msg = "Not able resolve constructor parameter " + cp;
               Class<?> ac = a.annotationType();
               if (ac == MatrixParam.class || ac == QueryParam.class || ac == PathParam.class)
                  throw new WebApplicationException(e, Response.status(Response.Status.NOT_FOUND).entity(msg)
                     .type(MediaType.TEXT_PLAIN).build());

               throw new WebApplicationException(e, Response.status(Response.Status.BAD_REQUEST).entity(msg)
View Full Code Here

  private boolean checkForAppropriateAnnotation(Set<ConstraintDescriptor<?>> constraintDescriptors) {
    boolean findPattern = false;
    for ( ConstraintDescriptor<?> constraintDescriptor : constraintDescriptors ) {
      Annotation ann = constraintDescriptor.getAnnotation();
      if ( Pattern.class.getName().equals( ann.annotationType().getName() ) ) {
        String regexp = ( (Pattern) ann ).regexp();
        if ( regexp.equals( "bar" ) ) {
          fail( "The regular expression attributes are defined in the composing constraint." );
        }
        findPattern = true;
View Full Code Here

  
   public void testDefaultValues() throws Exception
   {
      String expr = "@org.jboss.test.annotation.factory.support.ComplexWithDefault";
      Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, ComplexWithDefault.class);
      assertEquals(ComplexWithDefault.class, annotation.annotationType());
      ComplexWithDefault complex = (ComplexWithDefault)annotation;
      assertEquals('d', complex.ch());
      assertEquals("default", complex.string());
      assertEquals(1.0, complex.flt());
      assertEquals(2.3, complex.dbl());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.