Package javassist.bytecode

Examples of javassist.bytecode.ClassFile


    final Method[] setters = new Method[setterNames.length];
    findAccessors( targetBean, getterNames, setterNames, types, getters, setters );

    final Class beanClass;
    try {
      final ClassFile classfile = make( getters, setters );
      final ClassLoader loader = this.getClassLoader();
      if ( writeDirectory != null ) {
        FactoryHelper.writeFile( classfile, writeDirectory );
      }
View Full Code Here


    className = className + "_$$_bulkaccess_" + counter++;
    if ( className.startsWith( "java." ) ) {
      className = PACKAGE_NAME_PREFIX + className;
    }

    final ClassFile classfile = new ClassFile( false, className, BULKACESSOR_CLASS_NAME );
    classfile.setAccessFlags( AccessFlag.PUBLIC );
    addDefaultConstructor( classfile );
    addGetter( classfile, getters );
    addSetter( classfile, setters );
    return classfile;
  }
View Full Code Here

    this.callback = callback;
  }

  @Override
  public void handleEntry(ArchiveEntry entry, ArchiveContext context) {
    final ClassFile classFile = toClassFile( entry );
    final ClassDescriptor classDescriptor = toClassDescriptor( classFile, entry );

    if ( ! isListedOrDetectable( context, classDescriptor.getName() ) ) {
      return;
    }
View Full Code Here

  private ClassFile toClassFile(ArchiveEntry entry) {
    final InputStream inputStream = entry.getStreamAccess().accessInputStream();
    final DataInputStream dataInputStream = new DataInputStream( inputStream );
    try {
      return new ClassFile( dataInputStream );
    }
    catch (IOException e) {
      throw new ArchiveException( "Could not build ClassFile" );
    }
    finally {
View Full Code Here

    if ( filter.getAnnotations().length == 0 ) {
      is.close();
      return true;
    }
    DataInputStream dstream = new DataInputStream( is );
    ClassFile cf = null;

    try {
      cf = new ClassFile( dstream );
    }
    finally {
      dstream.close();
      is.close();
    }
    boolean match = false;
    AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute( AnnotationsAttribute.visibleTag );
    if ( visible != null ) {
      for ( Class annotation : filter.getAnnotations() ) {
        match = visible.getAnnotation( annotation.getName() ) != null;
        if ( match ) break;
      }
View Full Code Here

    Method[] setters = new Method[setterNames.length];
    findAccessors( targetBean, getterNames, setterNames, types, getters, setters );

    Class beanClass;
    try {
      ClassFile classfile = make( getters, setters );
      ClassLoader loader = this.getClassLoader();
      if ( writeDirectory != null ) {
        FactoryHelper.writeFile( classfile, writeDirectory );
      }
View Full Code Here

    className = className + "_$$_bulkaccess_" + counter++;
    if ( className.startsWith( "java." ) ) {
      className = "org.javassist.tmp." + className;
    }

    ClassFile classfile = new ClassFile( false, className, BULKACESSOR_CLASS_NAME );
    classfile.setAccessFlags( AccessFlag.PUBLIC );
    addDefaultConstructor( classfile );
    addGetter( classfile, getters );
    addSetter( classfile, setters );
    return classfile;
  }
View Full Code Here

    filter = f;
  }

  public void transform(File file) throws Exception {
    DataInputStream in = new DataInputStream(new FileInputStream(file));
    ClassFile classfile = new ClassFile(in);
    transform(classfile);
    DataOutputStream out = new DataOutputStream(new FileOutputStream(file));
    try {
      classfile.write(out);
    } finally {
      out.close();
    }
  }
View Full Code Here

    if ( filter.getAnnotations().length == 0 ) {
      is.close();
      return true;
    }
    DataInputStream dstream = new DataInputStream( is );
    ClassFile cf = null;

    try {
      cf = new ClassFile( dstream );
    }
    finally {
      dstream.close();
      is.close();
    }
    boolean match = false;
    AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute( AnnotationsAttribute.visibleTag );
    if ( visible != null ) {
      for ( Class annotation : filter.getAnnotations() ) {
        match = visible.getAnnotation( annotation.getName() ) != null;
        if ( match ) break;
      }
View Full Code Here

    private final byte[] bytes;
    private final ClassFile classFile;

    public CustomClassDescriptor(byte[] bytes) throws IOException {
      this.bytes = bytes;
      this.classFile = new ClassFile( new DataInputStream( new ByteArrayInputStream( bytes ) ) );
    }
View Full Code Here

TOP

Related Classes of javassist.bytecode.ClassFile

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.