Package org.jboss.forge.addon.parser.java.resources

Examples of org.jboss.forge.addon.parser.java.resources.JavaMethodResource


   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      JavaMethodResource resource = method.getValue();

      @SuppressWarnings("unchecked")
      Method<? extends JavaSource<?>> m = resource.getUnderlyingResourceObject();

      Annotation<? extends JavaSource<?>> annotation;
      if (m.hasAnnotation(TransactionAttribute.class))
      {
         annotation = m.getAnnotation(TransactionAttribute.class);
      }
      else
      {
         annotation = m.addAnnotation(TransactionAttribute.class);
      }
      annotation.setEnumValue(type.getValue());

      JavaSource<?> source = m.getOrigin();

      Resource<?> parent = resource.getParent();
      if (parent instanceof JavaResource)
         ((JavaResource) parent).setContents(source);

      return Results.success("Transaction attribute set to [" + type.getValue() + "]");
   }
View Full Code Here


   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      JavaMethodResource resource = method.getValue();

      @SuppressWarnings("unchecked")
      Method<? extends JavaSource<?>> m = resource.getUnderlyingResourceObject();

      Annotation<? extends JavaSource<?>> annotation;
      if (m.hasAnnotation(TransactionAttribute.class))
      {
         annotation = m.getAnnotation(TransactionAttribute.class);
      }
      else
      {
         annotation = m.addAnnotation(TransactionAttribute.class);
      }
      annotation.setEnumValue(type.getValue());

      JavaSource<?> source = m.getOrigin();

      Resource<?> parent = resource.getParent();
      if (parent instanceof JavaResource)
         ((JavaResource) parent).setContents(source);

      return Results.success("Transaction attribute set to [" + type.getValue() + "]");
   }
View Full Code Here

   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      JavaMethodResource resource = method.getValue();

      Method<?, ?> m = resource.getUnderlyingResourceObject();

      Annotation<?> annotation;
      if (m.hasAnnotation(TransactionAttribute.class))
      {
         annotation = m.getAnnotation(TransactionAttribute.class);
      }
      else
      {
         if (m instanceof MethodSource)
         {
            annotation = ((MethodSource<?>) m).addAnnotation(TransactionAttribute.class);
         }
         else
         {
            throw new IllegalStateException("Cannot add an annotation on a binary class");
         }
      }
      if (annotation instanceof AnnotationSource)
      {
         ((AnnotationSource<?>) annotation).setEnumValue(type.getValue());
      }

      JavaType<?> source = m.getOrigin();
      Resource<?> parent = resource.getParent();
      if (parent instanceof JavaResource && source instanceof JavaSource)
      {
         ((JavaResource) parent).setContents((JavaSource<?>) source);
      }
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.parser.java.resources.JavaMethodResource

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.