jawa.constants module¶
-
class
jawa.constants.Constant(pool, index)[source]¶ Bases:
objectThe base class for all
Constant*types.-
index¶
-
pool¶
-
-
class
jawa.constants.ConstantClass(pool, index, name_index)[source]¶ Bases:
jawa.constants.Constant-
TAG= 7¶
-
name¶
-
name_index¶
-
-
class
jawa.constants.ConstantPool[source]¶ Bases:
object-
create_class(name: str) → jawa.constants.ConstantClass[source]¶ Creates a new
ConstantClass, adding it to the pool and returning it.Parameters: name – The name of the new class.
-
create_double(value: float) → jawa.constants.Double[source]¶ Creates a new
ConstantDouble, adding it to the pool and returning it.Parameters: value – The value of the new Double.
-
create_field_ref(class_: str, field: str, descriptor: str) → jawa.constants.FieldReference[source]¶ Creates a new
ConstantFieldRef, adding it to the pool and returning it.Parameters: - class – The name of the class to which field belongs.
- field – The name of the field.
- descriptor – The descriptor for field.
-
create_float(value: float) → jawa.constants.Float[source]¶ Creates a new
ConstantFloat, adding it to the pool and returning it.Parameters: value – The value of the new float.
-
create_integer(value: int) → jawa.constants.Integer[source]¶ Creates a new
ConstantInteger, adding it to the pool and returning it.Parameters: value – The value of the new integer.
-
create_interface_method_ref(class_: str, if_method: str, descriptor: str) → jawa.constants.InterfaceMethodRef[source]¶ Creates a new
ConstantInterfaceMethodRef, adding it to the pool and returning it.Parameters: - class – The name of the class to which if_method belongs.
- if_method – The name of the interface method.
- descriptor – The descriptor for if_method.
-
create_long(value: int) → jawa.constants.Long[source]¶ Creates a new
ConstantLong, adding it to the pool and returning it.Parameters: value – The value of the new long.
-
create_method_ref(class_: str, method: str, descriptor: str) → jawa.constants.MethodReference[source]¶ Creates a new
ConstantMethodRef, adding it to the pool and returning it.Parameters: - class – The name of the class to which method belongs.
- method – The name of the method.
- descriptor – The descriptor for method.
-
create_name_and_type(name: str, descriptor: str) → jawa.constants.NameAndType[source]¶ Creates a new
ConstantNameAndType, adding it to the pool and returning it.Parameters: - name – The name of the class.
- descriptor – The descriptor for name.
-
create_string(value: str) → jawa.constants.String[source]¶ Creates a new
ConstantString, adding it to the pool and returning it.Parameters: value – The value of the new string as a UTF8 string.
-
create_utf8(value)[source]¶ Creates a new
ConstantUTF8, adding it to the pool and returning it.Parameters: value – The value of the new UTF8 string.
-
find(type_=None, f=None)[source]¶ Iterates over the pool, yielding each matching
Constant. Calling without any arguments is equivalent to iterating over the pool.Parameters: - type – Any subclass of
ConstantorNone. - f – Any callable which takes one argument (the constant).
- type – Any subclass of
-
find_one(*args, **kwargs)[source]¶ Same as
find()but returns only the first result, or None if nothing was found.
-
pack(fout)[source]¶ Write the ConstantPool to the file-like object fout.
Note
Advanced usage only. You will typically never need to call this method as it will be calle=d for you when saving a ClassFile.
Parameters: fout – Any file-like object providing write()
-
raw_count¶ The number of Constants in the ConstantPool, including padding.
-
-
class
jawa.constants.Double(pool, index, value)[source]¶ Bases:
jawa.constants.Number-
TAG= 6¶
-
-
class
jawa.constants.FieldReference(pool, index, class_index, name_and_type_index)[source]¶ Bases:
jawa.constants.Reference-
TAG= 9¶
-
-
class
jawa.constants.Float(pool, index, value)[source]¶ Bases:
jawa.constants.Number-
TAG= 4¶
-
-
class
jawa.constants.Integer(pool, index, value)[source]¶ Bases:
jawa.constants.Number-
TAG= 3¶
-
-
class
jawa.constants.InterfaceMethodRef(pool, index, class_index, name_and_type_index)[source]¶ Bases:
jawa.constants.Reference-
TAG= 11¶
-
-
class
jawa.constants.InvokeDynamic(pool, index, bootstrap_method_attr_index, name_and_type_index)[source]¶ Bases:
jawa.constants.Constant-
TAG= 18¶
-
bootstrap_method_attr_index¶
-
method_attr_index¶
-
name_and_type¶
-
name_and_type_index¶
-
-
class
jawa.constants.Long(pool, index, value)[source]¶ Bases:
jawa.constants.Number-
TAG= 5¶
-
-
class
jawa.constants.MethodHandle(pool, index, reference_kind, reference_index)[source]¶ Bases:
jawa.constants.Constant-
TAG= 15¶
-
reference¶
-
reference_index¶
-
reference_kind¶
-
-
class
jawa.constants.MethodReference(pool, index, class_index, name_and_type_index)[source]¶ Bases:
jawa.constants.Reference-
TAG= 10¶
-
-
class
jawa.constants.MethodType(pool, index, descriptor_index)[source]¶ Bases:
jawa.constants.Constant-
TAG= 16¶
-
descriptor¶
-
descriptor_index¶
-
-
class
jawa.constants.Module(pool, index, name_index)[source]¶ Bases:
jawa.constants.ConstantClass-
TAG= 19¶
-
name_index¶
-
-
class
jawa.constants.NameAndType(pool, index, name_index, descriptor_index)[source]¶ Bases:
jawa.constants.Constant-
TAG= 12¶
-
descriptor¶
-
descriptor_index¶
-
name¶
-
name_index¶
-
-
class
jawa.constants.Number(pool, index, value)[source]¶ Bases:
jawa.constants.Constant-
value¶
-
-
class
jawa.constants.PackageInfo(pool, index, name_index)[source]¶ Bases:
jawa.constants.ConstantClass-
TAG= 20¶
-
name_index¶
-
-
class
jawa.constants.Reference(pool, index, class_index, name_and_type_index)[source]¶ Bases:
jawa.constants.Constant-
TAG= None¶
-
class_¶
-
class_index¶
-
name_and_type¶
-
name_and_type_index¶
-