Package javassist

Examples of javassist.CtField$CodeInitializer


    }

    /** @since 1.1 */
    private void buildFields(StringBuffer buffer) throws NotFoundException
    {
        CtField fields[] = getCtClass().getDeclaredFields();

        for (int i = 0; i < fields.length; i++)
        {
            buffer.append("\n");
            buffer.append(modifiers(fields[i].getModifiers()));
View Full Code Here


    {
        CtClass ctType = convertClass(type);

        try
        {
            CtField field = new CtField(ctType, name, getCtClass());
            field.setModifiers(Modifier.PRIVATE);

            getCtClass().addField(field);
        }
        catch (CannotCompileException ex)
        {
View Full Code Here

      }
      if (fieldArray != null)
         return null;
      try
      {
         CtField field = ctClass.getDeclaredField(name);
         if (field == null)
            return null;
         return generateFieldInfo(field);
      }
      catch (NotFoundException e)
View Full Code Here

                            }
                            attribute.addAnnotation(ja);
                        }
                    }
                    String fieldName = method.getName() + "Argument" + i;
                    CtField ctField = CtField.make("public " + type.getCanonicalName() + " " + fieldName + ";", pool.getCtClass(parameterClassName));
                    ctField.getFieldInfo().addAttribute(attribute);
                    ctClass.addField(ctField);
                }
                parameterClass = ctClass.toClass();
            }
            Object parameterBean = parameterClass.newInstance();
View Full Code Here

        if (LOG.isDebugEnabled())
            LOG.debug("Creating field: " + fieldName);

        try
        {
            CtField field = new CtField(fieldType, fieldName, _genClass);
            _genClass.addField(field);
        }
        catch (CannotCompileException e)
        {
            throw new CodeGenerationException(e);
View Full Code Here

        if (LOG.isDebugEnabled())
            LOG.debug("Creating field: " + fieldName + " with initializer: " + init);

        try
        {
            CtField field = new CtField(fieldType, fieldName, _genClass);
            _genClass.addField(field, init);
        }
        catch (CannotCompileException e)
        {
            throw new CodeGenerationException(e);
View Full Code Here

     * @throws CannotCompileException if a compilation problem occurs
     */
    public static void addField( Class fieldType, String fieldName, CtClass enclosingClass )
            throws CannotCompileException
    {
        enclosingClass.addField( new CtField( resolve( fieldType ), fieldName, enclosingClass ) );
    }
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

TOP

Related Classes of javassist.CtField$CodeInitializer

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.