Package javassist.bytecode

Examples of javassist.bytecode.SignatureAttribute$ObjectType


   public static void addSignature(CtField field, String signature)
   {
      FieldInfo fieldInfo = field.getFieldInfo();
      ConstPool constPool = fieldInfo.getConstPool();
      SignatureAttribute signatureAttribute = new SignatureAttribute(constPool, signature);
      fieldInfo.addAttribute(signatureAttribute);
   }
View Full Code Here


   public static void addSignature(CtMethod method, String signature)
   {
      MethodInfo methodInfo = method.getMethodInfo();
      ConstPool constPool = methodInfo.getConstPool();
      SignatureAttribute signatureAttribute = new SignatureAttribute(constPool, signature);
      methodInfo.addAttribute(signatureAttribute);
   }
View Full Code Here

   public static Object getGenericType(Field f)
   {
      CtField fld = JavassistUtil.getCtField(f);
      FieldInfo info = fld.getFieldInfo2();
      SignatureAttribute sig = (SignatureAttribute)info.getAttribute(SignatureAttribute.tag);
      if (sig != null)
      {
         try
         {
            SignatureAttribute.ObjectType type = SignatureAttribute.toFieldSignature(sig.getSignature());
            return createType(f.getType(), type);
         }
         catch (BadBytecode e)
         {
            throw new RuntimeException(e);
View Full Code Here

   private static SignatureAttribute.ClassSignature getClassSignature(Class clazz)
   {
      CtClass ctclazz = JavassistUtil.getCtClass(clazz);
      ClassFile cf = ctclazz.getClassFile2();
      SignatureAttribute sig = (SignatureAttribute)cf.getAttribute(SignatureAttribute.tag);
      if (sig != null)
      {
         try
         {
            SignatureAttribute.ClassSignature type = SignatureAttribute.toClassSignature(sig.getSignature());
            return type;
         }
         catch (BadBytecode e)
         {
            throw new RuntimeException(e);
View Full Code Here

      return getMethodSignature(info);
   }
  
   private static SignatureAttribute.MethodSignature getMethodSignature(MethodInfo info)
   {
      SignatureAttribute sig = (SignatureAttribute)info.getAttribute(SignatureAttribute.tag);
      if (sig != null)
      {
         try
         {
            SignatureAttribute.MethodSignature type = SignatureAttribute.toMethodSignature(sig.getSignature());
            return type;
         }
         catch (BadBytecode e)
         {
            throw new RuntimeException(e);
View Full Code Here

      }
   }

   private void copySignature(MethodInfo src, MethodInfo dest)
   {
      SignatureAttribute attribute = (SignatureAttribute) src.getAttribute(SignatureAttribute.tag);
      if (attribute != null)
      {
         dest.addAttribute(attribute.copy(dest.getConstPool(), new HashMap()));
      }
   }
View Full Code Here

   private void copySignature(CtMethod src, CtMethod dest)
   {
      javassist.bytecode.MethodInfo srcInfo = src.getMethodInfo2();
      javassist.bytecode.MethodInfo destInfo = dest.getMethodInfo2();
     
      SignatureAttribute sig = (SignatureAttribute)srcInfo.getAttribute(SignatureAttribute.tag);
      if (sig != null)
      {
         destInfo.addAttribute(sig.copy(destInfo.getConstPool(), new HashMap()));
      }
   }
View Full Code Here

   private void copySignature(CtClass src, CtClass dest)
   {
      ClassFile srcFile = src.getClassFile2();
      ClassFile destFile = dest.getClassFile2();
     
      SignatureAttribute sig = (SignatureAttribute)srcFile.getAttribute(SignatureAttribute.tag);
      if (sig != null)
      {
         destFile.addAttribute(sig.copy(destFile.getConstPool(), new HashMap()));
      }
   }
View Full Code Here

      setTemporaryWrapperCode(type, wmethod);
      clazz.addMethod(wmethod);
     
      // copy attribute signature
      MethodInfo constructorInfo = constructor.getMethodInfo2();
      SignatureAttribute attribute = (SignatureAttribute) constructorInfo.getAttribute(SignatureAttribute.tag);
      if (attribute != null)
      {
         MethodInfo wrapperInfo = wmethod.getMethodInfo2();
         wrapperInfo.addAttribute(attribute.copy(wrapperInfo.getConstPool(), new HashMap()));
      }
     
      // prepare ForWrapping
      getWrapper().prepareForWrapping(constructor, CONSTRUCTOR_STATUS);
   }
View Full Code Here

      CtMethod wmethod = CtNewMethod.make(CtClass.voidType, wrapperName, writeParam, null, "{}", clazz);
      wmethod.setModifiers(mod);
      clazz.addMethod(wmethod);
     
      SignatureAttribute ai = (SignatureAttribute) field.getFieldInfo2().getAttribute(SignatureAttribute.tag);
      if (ai != null)
      {
         MethodInfo wrapperInfo = wmethod.getMethodInfo2();
         SignatureAttribute methodAtt = new SignatureAttribute(wrapperInfo.getConstPool(), "(" + ai.getSignature() + ")V");
         wrapperInfo.addAttribute(methodAtt);
      }
     
      return wmethod;
   }
View Full Code Here

TOP

Related Classes of javassist.bytecode.SignatureAttribute$ObjectType

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.