pub struct JvmMethodBuilder { /* private fields */ }Expand description
JVM method builder
Implementations§
Source§impl JvmMethodBuilder
impl JvmMethodBuilder
Sourcepub fn new(name: String, descriptor: String) -> Self
pub fn new(name: String, descriptor: String) -> Self
Creates a new JVM method builder with the given name and descriptor
Sourcepub fn with_public(self) -> Self
pub fn with_public(self) -> Self
Sets the method as public
Sourcepub fn with_private(self) -> Self
pub fn with_private(self) -> Self
Sets the method as private
Sourcepub fn with_protected(self) -> Self
pub fn with_protected(self) -> Self
Sets the method as protected
Sourcepub fn with_static(self) -> Self
pub fn with_static(self) -> Self
Sets the method as static
Sourcepub fn with_final(self) -> Self
pub fn with_final(self) -> Self
Sets the method as final
Sourcepub fn with_synchronized(self) -> Self
pub fn with_synchronized(self) -> Self
Sets the method as synchronized
Sourcepub fn with_max_stack(self, max_stack: u16) -> Self
pub fn with_max_stack(self, max_stack: u16) -> Self
Sets the maximum stack size for the method
Sourcepub fn with_max_locals(self, max_locals: u16) -> Self
pub fn with_max_locals(self, max_locals: u16) -> Self
Sets the maximum number of local variables for the method
Sourcepub fn add_instruction(self, instruction: JvmInstruction) -> Self
pub fn add_instruction(self, instruction: JvmInstruction) -> Self
Adds an instruction to the method
Sourcepub fn add_exception_handler(self, handler: JvmExceptionHandler) -> Self
pub fn add_exception_handler(self, handler: JvmExceptionHandler) -> Self
Adds an exception handler to the method
Sourcepub fn add_exception(self, exception: impl Into<String>) -> Self
pub fn add_exception(self, exception: impl Into<String>) -> Self
Adds a thrown exception to the method
Sourcepub fn aconst_null(self) -> Self
pub fn aconst_null(self) -> Self
Adds an ACONST_NULL instruction
Sourcepub fn getstatic(
self,
class: impl Into<String>,
name: impl Into<String>,
desc: impl Into<String>,
) -> Self
pub fn getstatic( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self
Adds a GETSTATIC instruction
Sourcepub fn putstatic(
self,
class: impl Into<String>,
name: impl Into<String>,
desc: impl Into<String>,
) -> Self
pub fn putstatic( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self
Adds a PUTSTATIC instruction
Sourcepub fn getfield(
self,
class: impl Into<String>,
name: impl Into<String>,
desc: impl Into<String>,
) -> Self
pub fn getfield( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self
Adds a GETFIELD instruction
Sourcepub fn putfield(
self,
class: impl Into<String>,
name: impl Into<String>,
desc: impl Into<String>,
) -> Self
pub fn putfield( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self
Adds a PUTFIELD instruction
Sourcepub fn invokevirtual(
self,
class: impl Into<String>,
name: impl Into<String>,
desc: impl Into<String>,
) -> Self
pub fn invokevirtual( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self
Adds an INVOKEVIRTUAL instruction
Sourcepub fn invokespecial(
self,
class: impl Into<String>,
name: impl Into<String>,
desc: impl Into<String>,
) -> Self
pub fn invokespecial( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self
Adds an INVOKESPECIAL instruction
Sourcepub fn invokestatic(
self,
class: impl Into<String>,
name: impl Into<String>,
desc: impl Into<String>,
) -> Self
pub fn invokestatic( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self
Adds an INVOKESTATIC instruction
Sourcepub fn invokeinterface(
self,
class: impl Into<String>,
name: impl Into<String>,
desc: impl Into<String>,
) -> Self
pub fn invokeinterface( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self
Adds an INVOKEINTERFACE instruction
Sourcepub fn new_instance(self, class: impl Into<String>) -> Self
pub fn new_instance(self, class: impl Into<String>) -> Self
Adds a NEW instruction
Sourcepub fn return_void(self) -> Self
pub fn return_void(self) -> Self
Adds a RETURN instruction