pub struct Class { /* private fields */ }Expand description
A complete, decoded Java class file.
This type owns the parsed class-file data. Its member and constant-pool accessors return borrowed views, so no additional model allocation is required while inspecting a class.
Implementations§
Source§impl Class
impl Class
Sourcepub fn version(&self) -> ClassVersion
pub fn version(&self) -> ClassVersion
Returns the class-file version recorded in the header.
Sourcepub fn access_flags(&self) -> u16
pub fn access_flags(&self) -> u16
Returns the raw class access-flag bitset.
Interpret the bits in the context of the Java Virtual Machine Specification’s ClassFile
access flags.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Returns this class’s internal JVM name.
Internal names use slash-separated package segments and are not normalized by FerroBabe.
Sourcepub fn super_name(&self) -> Option<&str>
pub fn super_name(&self) -> Option<&str>
Returns the direct superclass internal name, if the class has one.
None represents the java/lang/Object root class.
Sourcepub fn source_file(&self) -> Option<&str>
pub fn source_file(&self) -> Option<&str>
Returns the SourceFile attribute value when present.
Sourcepub fn interfaces(&self) -> impl ExactSizeIterator<Item = &str>
pub fn interfaces(&self) -> impl ExactSizeIterator<Item = &str>
Iterates over direct interface internal names in class-file order.
Sourcepub fn fields(&self) -> impl ExactSizeIterator<Item = Field<'_>>
pub fn fields(&self) -> impl ExactSizeIterator<Item = Field<'_>>
Iterates over fields in class-file order.
Sourcepub fn methods(&self) -> impl ExactSizeIterator<Item = Method<'_>>
pub fn methods(&self) -> impl ExactSizeIterator<Item = Method<'_>>
Iterates over methods in class-file order.
Each returned method can borrow the class constant pool to resolve exception handler names.
Sourcepub fn constants(
&self,
) -> impl ExactSizeIterator<Item = (ConstantPoolIndex, ConstantRef<'_>)>
pub fn constants( &self, ) -> impl ExactSizeIterator<Item = (ConstantPoolIndex, ConstantRef<'_>)>
Iterates over every constant-pool slot, including unusable reserved slots.
The returned index is the original one-based class-file index. Slot zero is included only
when supplied by the underlying model and is reported as ConstantRef::Unusable.
Sourcepub fn constant(&self, index: ConstantPoolIndex) -> Option<ConstantRef<'_>>
pub fn constant(&self, index: ConstantPoolIndex) -> Option<ConstantRef<'_>>
Returns the constant-pool entry at index.
Returns None when index is outside the decoded constant pool.