Examples of JavaAnnotation


Examples of org.apache.cxf.tools.common.model.JavaAnnotation

        }

        JavaParameter asyncHandler = new JavaParameter();
        asyncHandler.setName("asyncHandler");
        asyncHandler.setClassName(getAsyncClassName(method, "AsyncHandler"));
        JavaAnnotation asyncHandlerAnnotation = new JavaAnnotation("WebParam");
        asyncHandlerAnnotation.addArgument("name", "asyncHandler");
        asyncHandlerAnnotation.addArgument("targetNamespace", "");
        asyncHandler.setAnnotation(asyncHandlerAnnotation);

        pollingMethod.addParameter(asyncHandler);

        method.getInterface().addMethod(pollingMethod);
View Full Code Here

Examples of org.eclipse.persistence.jaxb.javamodel.JavaAnnotation

     * @param annotationClass
     * @return
     * @see isAnnotationPresent
     */
    public Annotation getAnnotation(JavaHasAnnotations element, Class annotationClass) {
        JavaAnnotation janno = element.getAnnotation(jModel.getClass(annotationClass));
        if (janno == null) {
            return null;
        }
        return jModel.getAnnotation(janno, annotationClass);
    }
View Full Code Here

Examples of org.eclipse.persistence.jaxb.javamodel.JavaAnnotation

     * @param annotationClass
     * @return
     * @see isAnnotationPresent
     */
    public Annotation getAnnotation(JavaHasAnnotations element, Class annotationClass) {
        JavaAnnotation janno = element.getAnnotation(jModel.getClass(annotationClass));
        if (janno == null) {
            return null;
        }
        return jModel.getAnnotation(janno, annotationClass);
    }
View Full Code Here

Examples of org.eclipse.persistence.jaxb.javamodel.JavaAnnotation

     * @param annotationClass
     * @return
     * @see isAnnotationPresent
     */
    public Annotation getAnnotation(JavaHasAnnotations element, Class annotationClass) {
        JavaAnnotation janno = element.getAnnotation(jModel.getClass(annotationClass));
        if (janno == null) {
            return null;
        }
        return jModel.getAnnotation(janno, annotationClass);
    }
View Full Code Here

Examples of org.eclipse.persistence.jaxb.javamodel.JavaAnnotation

     * @param annotationClass
     * @return
     * @see isAnnotationPresent
     */
    public Annotation getAnnotation(JavaHasAnnotations element, Class annotationClass) {
        JavaAnnotation janno = element.getAnnotation(jModel.getClass(annotationClass));
        if (janno == null) {
            return null;
        }
        return jModel.getAnnotation(janno, annotationClass);
    }
View Full Code Here

Examples of org.eclipse.persistence.jaxb.javamodel.JavaAnnotation

     * @param annotationClass
     * @return
     * @see isAnnotationPresent
     */
    public Annotation getAnnotation(JavaHasAnnotations element, Class annotationClass) {
        JavaAnnotation janno = element.getAnnotation(jModel.getClass(annotationClass));
        if (janno == null) {
            return null;
        }
        return jModel.getAnnotation(janno, annotationClass);
    }
View Full Code Here

Examples of org.jboss.forge.parser.java.JavaAnnotation

                     help = "the annotation definition: surround with quotes",
                     description = "annotation definition") final String... def) throws FileNotFoundException
   {
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);

      JavaAnnotation type = null;
      if (def != null)
      {
         String classDef = Strings.join(Arrays.asList(def), " ");
         type = JavaParser.parse(JavaAnnotation.class, classDef);
      }
      else if (in != null)
      {
         type = JavaParser.parse(JavaAnnotation.class, in);
      }
      else if (annotationName != null)
      {
         type = JavaParser.create(JavaAnnotation.class).setName(annotationName);
      }
      else
      {
         throw new RuntimeException("arguments required");
      }

      if (pckg != null)
      {
         type.setPackage(pckg);
      }

      if (documented)
      {
         type.addAnnotation(Documented.class);
      }
      if (retentionPolicy != null)
      {
         type.addAnnotation(Retention.class).setEnumValue(retentionPolicy);
      }
      final Set<ElementType> targetTypes;
      if (noTarget)
      {
         targetTypes = Collections.emptySet();
      }
      else
      {
         targetTypes = shell.promptMultiSelectWithWildcard("*",
                  "Select target element types", ElementType.values());
      }
      if (targetTypes.isEmpty())
      {
         shell.printlnVerbose("Skipping @Target annotation");
      }
      else
      {
         type.addAnnotation(Target.class).setEnumValue(targetTypes.toArray(new ElementType[targetTypes.size()]));
      }

      if (!type.hasSyntaxErrors())
      {
         java.saveJavaSource(type);
      }
      else
      {
         writer.println(ShellColor.RED, "Syntax Errors:");
         for (SyntaxError error : type.getSyntaxErrors())
         {
            writer.println(error.toString());
         }
         writer.println();

View Full Code Here

Examples of org.jboss.forge.parser.java.JavaAnnotation

      }

      JavaSource<?> source = resource.getJavaSource();
      if (source.isAnnotation())
      {
         JavaAnnotation parent = JavaAnnotation.class.cast(source);

         String addName;
         if (elementDef != null)
         {
            addName = JavaParser.parse(JavaAnnotation.class, "public @interface Temp{}")
                     .addAnnotationElement(elementDef).getName();
         }
         else
         {
            addName = name;
         }

         if (parent.hasAnnotationElement(addName))
         {
            throw new IllegalStateException("Element named [" + addName + "] already exists.");
         }

         if (elementDef != null)
         {
            parent.addAnnotationElement(elementDef);
         }
         else
         {
            parent.addAnnotationElement().setName(name).setType(type);
         }
         java.saveJavaSource(source);
      }
   }
View Full Code Here

Examples of org.jboss.forge.parser.java.JavaAnnotation

      Result result = super.execute(context);
      if (!(result instanceof Failed))
      {
         JavaSourceFacet javaSourceFacet = getSelectedProject(context).getFacet(JavaSourceFacet.class);
         JavaResource javaResource = context.getUIContext().getSelection();
         JavaAnnotation constraint = (JavaAnnotation) javaResource.getJavaSource();
         // Constraint annotation header
         constraint.addAnnotation(Constraint.class).setStringValue("validatedBy = {}");
         constraint.addAnnotation(ReportAsSingleViolation.class);
         constraint.addAnnotation(Retention.class).setEnumValue(RUNTIME);
         constraint.addAnnotation(Target.class).setEnumValue(METHOD, FIELD, PARAMETER, TYPE, ANNOTATION_TYPE, CONSTRUCTOR);
         constraint.addAnnotation(Documented.class);
         // Constraint annotation body
         constraint.addAnnotationElement("String message() default \"Invalid value\"");
         constraint.addAnnotationElement("Class<?>[] groups() default { }");
         constraint.addAnnotationElement("Class<? extends Payload>[] payload() default { }");

         javaSourceFacet.saveJavaSource(constraint);
      }
      return result;
   }
View Full Code Here

Examples of org.jboss.forge.parser.java.JavaAnnotation

      if (!declaration.trim().endsWith(";"))
      {
         declaration = declaration + ";";
      }
      String stub = "public @interface Stub { " + declaration + " }";
      JavaAnnotation temp = (JavaAnnotation) JavaParser.parse(stub);
      List<AnnotationElement> fields = temp.getAnnotationElements();
      AnnotationTypeMemberDeclaration newField = (AnnotationTypeMemberDeclaration) fields.get(0).getInternal();
      return (AnnotationTypeMemberDeclaration) ASTNode.copySubtree(((ASTNode) parent.getInternal()).getAST(), newField);
   }
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.