jawa.methods module¶
-
class
jawa.methods.
Method
(cf)[source]¶ Bases:
object
-
code
¶ A shortcut for
method.attributes.find_one(name='Code')
.
-
descriptor
¶ The UTF8 Constant containing the method’s descriptor.
-
name
¶ The UTF8 Constant containing the method’s name.
-
-
class
jawa.methods.
MethodTable
(cf)[source]¶ Bases:
object
-
create
(name: str, descriptor: str, code: jawa.attributes.code.CodeAttribute = None) → jawa.methods.Method[source]¶ Creates a new method from name and descriptor. If code is not
None
, add a Code attribute to this method.
-
find
(*, name: str = None, args: str = None, returns: str = None, f: Callable = None) → Iterator[jawa.methods.Method][source]¶ Iterates over the methods table, yielding each matching method. Calling without any arguments is equivalent to iterating over the table. For example, to get all methods that take three integers and return void:
for method in cf.methods.find(args='III', returns='V'): print(method.name.value)
Or to get all private methods:
is_private = lambda m: m.access_flags.acc_private for method in cf.methods.find(f=is_private): print method.name.value
Parameters: - name – The name of the method(s) to find.
- args – The arguments descriptor (ex:
III
) - returns – The returns descriptor (Ex:
V
) - f – Any callable which takes one argument (the method).
-
find_one
(**kwargs) → Union[jawa.methods.Method, NoneType][source]¶ Same as
find()
but returns only the first result.
-