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_module(
&mut self,
_name: &str,
_access_flags: u16,
_version: Option<&str>,
) -> Option<Box<dyn ModuleVisitor>> { ... }
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_module -> (visit_field | visit_method)* -> visit_end.
Provided Methods§
Sourcefn visit(
&mut self,
_major: u16,
_minor: u16,
_access_flags: u16,
_name: &str,
_super_name: Option<&str>,
_interfaces: &[String],
)
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 (seeOpcodes).name- The internal name of the class.super_name- The internal name of the super class (e.g.,java/lang/String,a/b/c). UseNoneforObject.interfaces- The internal names of the class’s interfaces.
Sourcefn visit_source(&mut self, _source: &str)
fn visit_source(&mut self, _source: &str)
Visits the source file name of the class.
Sourcefn visit_module(
&mut self,
_name: &str,
_access_flags: u16,
_version: Option<&str>,
) -> Option<Box<dyn ModuleVisitor>>
fn visit_module( &mut self, _name: &str, _access_flags: u16, _version: Option<&str>, ) -> Option<Box<dyn ModuleVisitor>>
Visits the JPMS module descriptor of this class, if this is a module-info.class.
Sourcefn visit_field(
&mut self,
_access_flags: u16,
_name: &str,
_descriptor: &str,
) -> Option<Box<dyn FieldVisitor>>
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.
Sourcefn visit_method(
&mut self,
_access_flags: u16,
_name: &str,
_descriptor: &str,
) -> Option<Box<dyn MethodVisitor>>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".