Package javassist.bytecode.annotation

Examples of javassist.bytecode.annotation.Annotation


  
   public void visitAnnotationMemberValue(AnnotationMemberValue node)
   {
      try
      {
         Annotation ann = node.getValue();
         value = AnnotationProxy.createProxy(ann);
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
View Full Code Here


      theField.setModifiers( theField.getModifiers() | Modifier.TRANSIENT );
    }
    theField.setModifiers( Modifier.setPrivate( theField.getModifiers() ) );

    final AnnotationsAttribute annotationsAttribute = getVisibleAnnotations( theField.getFieldInfo() );
    annotationsAttribute.addAnnotation( new Annotation( Transient.class.getName(), constPool ) );
    return theField;
  }
View Full Code Here

         boolean changed = false;
         for (int i = 0; i < annotations.length; i++)
         {
            if (annotations[i].getTypeName().equals(Inherited.class.getName()))
            {
               annotations[i] = new Annotation("org/jboss/lang/annotation/Inherited", file.getConstPool());
               changed = true;
            }
         }
         if (changed)
         {
View Full Code Here

                        ctMethod.setBody("runCommand(\"" + name + "\", $1, $2);");
                        ctClass.addMethod(ctMethod);

                        // add GoGo descriptor for this shell command
                        AnnotationsAttribute annotationsAttribute = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag);
                        Annotation annotation = new Annotation(Descriptor.class.getName(), constPool);
                        annotation.addMemberValue("value", new StringMemberValue(commands.get(name), constPool));
                        annotationsAttribute.addAnnotation(annotation);
                        ctMethod.getMethodInfo().addAttribute(annotationsAttribute);
                    }
                }
            }
View Full Code Here

      final SignatureAttribute signatureAttribute = new SignatureAttribute(constantPool, signature) ;
      seiClass.getClassFile().addAttribute(signatureAttribute) ;

      AnnotationsAttribute attribute = new AnnotationsAttribute(
          constantPool, AnnotationsAttribute.visibleTag);
      Annotation annotation = new Annotation(
          "javax.xml.ws.WebServiceProvider", constantPool);
      StringMemberValue strValue1 = new StringMemberValue(constantPool);
      strValue1.setValue(epInfo.getWSDLFileName());
      annotation.addMemberValue("wsdlLocation", strValue1);
      StringMemberValue strValue2 = new StringMemberValue(constantPool);
      strValue2.setValue(epInfo.getServiceName());
      annotation.addMemberValue("serviceName", strValue2);
      StringMemberValue strValue3 = new StringMemberValue(constantPool);
      strValue3.setValue(epInfo.getPortName());
      annotation.addMemberValue("portName", strValue3);

      StringMemberValue strValue4 = new StringMemberValue(constantPool);
      strValue4.setValue(epInfo.getNamespace());
      annotation.addMemberValue("targetNamespace", strValue4);

      attribute.addAnnotation(annotation);

      Annotation annotation2 = new Annotation("javax.xml.ws.ServiceMode",
          constantPool);
      EnumMemberValue enumValue = new EnumMemberValue(constantPool);
      enumValue.setType("javax.xml.ws.Service$Mode");
      enumValue.setValue("MESSAGE");
      annotation2.addMemberValue("value", enumValue);
      attribute.addAnnotation(annotation2);

      if (epInfo.isAddressing() && JBossDeployerUtil.getWSImpl().equals(JBossDeployerUtil.WSIMPL_CXF))
      {
        Annotation annotation3 = new Annotation("javax.xml.ws.soap.Addressing", constantPool);
        BooleanMemberValue boolEnabled = new BooleanMemberValue(constantPool);
        boolEnabled.setValue(true);
        BooleanMemberValue boolRequired = new BooleanMemberValue(constantPool);
        boolRequired.setValue(true);
        annotation3.addMemberValue("enabled", boolEnabled);
        annotation3.addMemberValue("required", boolEnabled);
        attribute.addAnnotation(annotation3);
      }

      if (includeHandlers)
      {
        final Annotation handlerChainAnnotation = new Annotation("javax.jws.HandlerChain", constantPool) ;
        final StringMemberValue handlerValue = new StringMemberValue(constantPool) ;
        handlerValue.setValue("esb-jaxws-handlers.xml") ;
        handlerChainAnnotation.addMemberValue("file", handlerValue) ;
        attribute.addAnnotation(handlerChainAnnotation) ;
      }
     
      seiClass.getClassFile().addAttribute(attribute);
     
View Full Code Here

     * @throws NotFoundException
     */
    private static Annotation cloneAnnotation(Annotation annotation, final ConstPool constPool)
        throws NotFoundException {

        Annotation ret = new Annotation(annotation.getTypeName(), constPool);

        if (annotation.getMemberNames() != null) {
            for (Object m : annotation.getMemberNames()) {
                final String memberName = (String) m;

                MemberValue origValue = annotation.getMemberValue(memberName);
                final MemberValue[] newValue = new MemberValue[1];

                origValue.accept(new ArrayIndexAssigningVisitor(newValue, 0, constPool));

                ret.addMemberValue(memberName, newValue[0]);
            }
        }

        return ret;
    }
View Full Code Here

            Annotation[][] newParameterAnnotations = new Annotation[originalAnnotations.length - fromIndex][];

            for (int i = fromIndex; i < originalAnnotations.length; i++) {
                newParameterAnnotations[i - fromIndex] = new Annotation[originalAnnotations[i].length];
                for (int j = 0; j < originalAnnotations[i].length; ++j) {
                    Annotation origAnnotation = originalAnnotations[i][j];

                    newParameterAnnotations[i - fromIndex][j] = cloneAnnotation(origAnnotation, constPool);
                }
            }
View Full Code Here

        if (annotations == null) {
            annotations = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag);
        }

        Annotation simplified = new Annotation(SimplifiedClass.class.getName(), constPool);
        simplified.addMemberValue("originalClass", new ClassMemberValue(originalClassName, constPool));

        annotations.addAnnotation(simplified);

        return annotations;
    }
View Full Code Here

        if (annotations == null) {
            annotations = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag);
        }

        annotations.addAnnotation(new Annotation(SimplifiedMethod.class.getName(), constPool));

        return annotations;
    }
View Full Code Here

                    Annotation[][] newAnnotations = new Annotation[params.length][1];
                    int i = 0;
                    for (String paramName : types.keySet()) {
                        newAnnotations[i] = new Annotation[1];

                        newAnnotations[i][0] = new Annotation(WebParam.class.getName(), method.getMethodInfo()
                                .getConstPool());
                        newAnnotations[i][0].addMemberValue("name", new StringMemberValue(paramName, method
                                .getMethodInfo().getConstPool()));
                        i++;
                    }
View Full Code Here

TOP

Related Classes of javassist.bytecode.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.