Package javassist.bytecode

Examples of javassist.bytecode.FieldInfo


  }

  private void addFieldHandlerField(ClassFile classfile)
      throws CannotCompileException {
    ConstPool cp = classfile.getConstPool();
    FieldInfo finfo = new FieldInfo(cp, HANDLER_FIELD_NAME,
                                    HANDLER_FIELD_DESCRIPTOR);
    finfo.setAccessFlags(AccessFlag.PRIVATE | AccessFlag.TRANSIENT);
    classfile.addField(finfo);
  }
View Full Code Here


  private void addReadWriteMethods(ClassFile classfile)
      throws CannotCompileException {
    List fields = classfile.getFields();
    for (Iterator field_iter = fields.iterator(); field_iter.hasNext();) {
      FieldInfo finfo = (FieldInfo) field_iter.next();
      if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0
          && (!finfo.getName().equals(HANDLER_FIELD_NAME))) {
        // case of non-static field
        if (filter.handleRead(finfo.getDescriptor(), finfo
            .getName())) {
          addReadMethod(classfile, finfo);
        }
        if (filter.handleWrite(finfo.getDescriptor(), finfo
            .getName())) {
          addWriteMethod(classfile, finfo);
        }
      }
    }
View Full Code Here

    }
  }

  private void addFieldHandlerField(ClassFile classfile) throws CannotCompileException {
    final ConstPool constPool = classfile.getConstPool();
    final FieldInfo fieldInfo = new FieldInfo( constPool, HANDLER_FIELD_NAME, HANDLER_FIELD_DESCRIPTOR );
    fieldInfo.setAccessFlags( AccessFlag.PRIVATE | AccessFlag.TRANSIENT );
    classfile.addField( fieldInfo );
  }
View Full Code Here

  }

  private void addReadWriteMethods(ClassFile classfile) throws CannotCompileException, BadBytecode {
    final List fields = classfile.getFields();
    for ( Object field : fields ) {
      final FieldInfo finfo = (FieldInfo) field;
      if ( (finfo.getAccessFlags() & AccessFlag.STATIC) == 0 && (!finfo.getName().equals( HANDLER_FIELD_NAME )) ) {
        // case of non-static field
        if ( filter.handleRead( finfo.getDescriptor(), finfo.getName() ) ) {
          addReadMethod( classfile, finfo );
        }
        if ( filter.handleWrite( finfo.getDescriptor(), finfo.getName() ) ) {
          addWriteMethod( classfile, finfo );
        }
      }
    }
  }
View Full Code Here

  }

  private void addFieldHandlerField(ClassFile classfile)
      throws CannotCompileException {
    ConstPool cp = classfile.getConstPool();
    FieldInfo finfo = new FieldInfo(cp, HANDLER_FIELD_NAME,
                                    HANDLER_FIELD_DESCRIPTOR);
    finfo.setAccessFlags(AccessFlag.PRIVATE | AccessFlag.TRANSIENT);
    classfile.addField(finfo);
  }
View Full Code Here

  private void addReadWriteMethods(ClassFile classfile)
      throws CannotCompileException {
    List fields = classfile.getFields();
    for (Iterator field_iter = fields.iterator(); field_iter.hasNext();) {
      FieldInfo finfo = (FieldInfo) field_iter.next();
      if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0
          && (!finfo.getName().equals(HANDLER_FIELD_NAME))) {
        // case of non-static field
        if (filter.handleRead(finfo.getDescriptor(), finfo
            .getName())) {
          addReadMethod(classfile, finfo);
          readableFields.put(finfo.getName(), finfo
              .getDescriptor());
        }
        if (filter.handleWrite(finfo.getDescriptor(), finfo
            .getName())) {
          addWriteMethod(classfile, finfo);
          writableFields.put(finfo.getName(), finfo
              .getDescriptor());
        }
      }
    }
  }
View Full Code Here

  }

  private void addFieldHandlerField(ClassFile classfile)
      throws CannotCompileException {
    ConstPool cp = classfile.getConstPool();
    FieldInfo finfo = new FieldInfo(cp, HANDLER_FIELD_NAME,
                                    HANDLER_FIELD_DESCRIPTOR);
    finfo.setAccessFlags(AccessFlag.PRIVATE | AccessFlag.TRANSIENT);
    classfile.addField(finfo);
  }
View Full Code Here

  private void addReadWriteMethods(ClassFile classfile)
      throws CannotCompileException {
    List fields = classfile.getFields();
    for (Iterator field_iter = fields.iterator(); field_iter.hasNext();) {
      FieldInfo finfo = (FieldInfo) field_iter.next();
      if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0
          && (!finfo.getName().equals(HANDLER_FIELD_NAME))) {
        // case of non-static field
        if (filter.handleRead(finfo.getDescriptor(), finfo
            .getName())) {
          addReadMethod(classfile, finfo);
        }
        if (filter.handleWrite(finfo.getDescriptor(), finfo
            .getName())) {
          addWriteMethod(classfile, finfo);
        }
      }
    }
View Full Code Here

      CtClass managedCtClass,
      CtField persistentField,
      AttributeTypeDescriptor typeDescriptor)
      throws BadBytecode, CannotCompileException {

    final FieldInfo fieldInfo = persistentField.getFieldInfo();
    final String fieldName = fieldInfo.getName();
    final String readerName = EnhancerConstants.PERSISTENT_FIELD_READER_PREFIX + fieldName;

    // read attempts only have to deal lazy-loading support, not dirty checking; so if the field
    // is not enabled as lazy-loadable return a plain simple getter as the reader
    if ( !enhancementContext.isLazyLoadable( persistentField ) ) {
View Full Code Here

  private CtMethod generateFieldWriter(
      CtClass managedCtClass,
      CtField persistentField,
      AttributeTypeDescriptor typeDescriptor) {

    final FieldInfo fieldInfo = persistentField.getFieldInfo();
    final String fieldName = fieldInfo.getName();
    final String writerName = EnhancerConstants.PERSISTENT_FIELD_WRITER_PREFIX + fieldName;

    final CtMethod writer;

    try {
View Full Code Here

TOP

Related Classes of javassist.bytecode.FieldInfo

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.