Package javassist

Examples of javassist.CtField$StringInitializer


   protected CtField addProtectedField(CtClass clazz, String name, String typeName,
                                     CtField.Initializer initializer)
           throws CannotCompileException, NotFoundException
   {
      CtClass type = forName(typeName);
      CtField field = new CtField(type, name, clazz);
      field.setModifiers(Modifier.PROTECTED | Modifier.TRANSIENT);
      Instrumentor.addSyntheticAttribute(field);
      if (initializer != null)
      {
         clazz.addField(field, initializer);
      }
View Full Code Here


      return buf.toString();
   }

   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
         {
View Full Code Here

      {
         String name = field.getName();
         String typeName = Descriptor.toJavaName(field.getDescriptor());
         try
         {
            CtField ctField = clazz.getField(name);
            ctField.getType();
         }
         catch (NotFoundException e)
         {
            if (failed == 0)
               System.out.println("==== " + info.getFile());
View Full Code Here

    */
   private void addAspectFieldAndGetter(ClassPool pool, CtClass clazz, AdviceSetup setup) throws NotFoundException, CannotCompileException
   {
      CtClass aspectClass = setup.getAspectCtClass();
     
      CtField field = new CtField(aspectClass, setup.getAspectFieldName(), clazz);
      field.setModifiers(Modifier.PRIVATE | Modifier.TRANSIENT);
      clazz.addField(field);
     
      String body = getAspectFieldGetterBody(setup);
      CtMethod method = CtNewMethod.make(
            aspectClass,
View Full Code Here

         if (useCFlowIndex == null)
         {
            useCFlowIndex = new Integer(setup.getIndex());
            cflows.put(setup.getCFlowString(), useCFlowIndex);
           
            CtField cflowX = new CtField(
                  pool.get(ASTCFlowExpression.class.getName()),
                  "cflow" + useCFlowIndex,
                  clazz);
            clazz.addField(cflowX);
           
            CtField matchesCFlowX = new CtField(
                  CtClass.booleanType,
                  "matchesCflow" + useCFlowIndex,
                  clazz);
            clazz.addField(matchesCFlowX);
           
View Full Code Here

      }
   }
  
   private void addLightweightInstanceAspectsTrackerFields(CtClass clazz) throws CannotCompileException
   {
      CtField initialised = new CtField(CtClass.booleanType, INITIALISED_LIGHTWEIGHT_INSTANCE_ASPECTS, clazz);
      clazz.addField(initialised);
     
      CtField forInstance = new CtField(CtClass.booleanType, IS_FOR_INSTANCE_ADVISOR, clazz);
      clazz.addField(forInstance);
   }
View Full Code Here

    static boolean isFieldInSuper(CtClass clazz, CtClass fclass, String fname) {
        if (!clazz.subclassOf(fclass))
            return false;

        try {
            CtField f = clazz.getField(fname);
            return f.getDeclaringClass() == fclass;
        }
        catch (NotFoundException e) {}
        return false;
    }
View Full Code Here

    }

    protected void atFieldAssign(Expr expr, int op, ASTree left, ASTree right)
        throws CompileError
    {
        CtField f = fieldAccess(left);
        atFieldRead(f);
        int fType = exprType;
        int fDim = arrayDim;
        String cname = className;
        right.accept(this);
View Full Code Here

    protected CtField fieldAccess(ASTree expr) throws CompileError {
        if (expr instanceof Member) {
            Member mem = (Member)expr;
            String name = mem.get();
            try {
                CtField f = thisClass.getField(name);
                if (Modifier.isStatic(f.getModifiers()))
                    mem.setField(f);

                return f;
            }
            catch (NotFoundException e) {
                // EXPR might be part of a static member access?
                throw new NoFieldException(name, expr);
            }
        }
        else if (expr instanceof Expr) {
            Expr e = (Expr)expr;
            int op = e.getOperator();
            if (op == MEMBER) {
                Member mem = (Member)e.oprand2();
                CtField f
                    = resolver.lookupField(((Symbol)e.oprand1()).get(), mem);
                mem.setField(f);
                return f;
            }
            else if (op == '.') {
View Full Code Here

        throw new CompileError("bad filed access");
    }

    private CtField fieldAccess2(Expr e, String jvmClassName) throws CompileError {
        Member fname = (Member)e.oprand2();
        CtField f = resolver.lookupFieldByJvmName2(jvmClassName, fname, e);
        e.setOperator(MEMBER);
        e.setOprand1(new Symbol(MemberResolver.jvmToJavaName(jvmClassName)));
        fname.setField(f);
        return f;
    }
View Full Code Here

TOP

Related Classes of javassist.CtField$StringInitializer

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.