Skip to main content

ClassVisitor

Trait ClassVisitor 

Source
pub trait ClassVisitor {
    // Provided methods
    fn visit(
        &mut self,
        _major: u16,
        _minor: u16,
        _access_flags: u16,
        _name: &str,
        _super_name: Option<&str>,
        _interfaces: &[String],
    ) { ... }
    fn visit_source(&mut self, _source: &str) { ... }
    fn visit_field(
        &mut self,
        _access_flags: u16,
        _name: &str,
        _descriptor: &str,
    ) -> Option<Box<dyn FieldVisitor>> { ... }
    fn visit_method(
        &mut self,
        _access_flags: u16,
        _name: &str,
        _descriptor: &str,
    ) -> Option<Box<dyn MethodVisitor>> { ... }
    fn visit_end(&mut self) { ... }
}
Expand description

A visitor to visit a Java class.

The methods of this trait must be called in the following order: visit -> visit_source -> (visit_field | visit_method)* -> visit_end.

Provided Methods§

Source

fn visit( &mut self, _major: u16, _minor: u16, _access_flags: u16, _name: &str, _super_name: Option<&str>, _interfaces: &[String], )

Visits the header of the class.

§Arguments
  • major - The major version number of the class file.
  • minor - The minor version number of the class file.
  • access_flags - The class’s access flags (see Opcodes).
  • name - The internal name of the class.
  • super_name - The internal name of the super class (e.g., java/lang/String, a/b/c). Use None for Object.
  • interfaces - The internal names of the class’s interfaces.
Source

fn visit_source(&mut self, _source: &str)

Visits the source file name of the class.

Source

fn visit_field( &mut self, _access_flags: u16, _name: &str, _descriptor: &str, ) -> Option<Box<dyn FieldVisitor>>

Visits a field of the class.

Returns an optional FieldVisitor to visit the field’s content.

Source

fn visit_method( &mut self, _access_flags: u16, _name: &str, _descriptor: &str, ) -> Option<Box<dyn MethodVisitor>>

Visits a method of the class.

Returns an optional MethodVisitor to visit the method’s code.

Source

fn visit_end(&mut self)

Visits the end of the class.

Implementors§