Class: Java::Class

Inherits:
Annotatable show all
Defined in:
lib/java_dissassembler/class.rb

Constant Summary collapse

ACC_PUBLIC =

Declared public; may be accessed from outside its package.

0x0001
ACC_FINAL =

Declared final; no subclasses allowed.

0x0010
ACC_SUPER =

Treat superclass methods specially when invoked by the invokespecial instruction.

0x0020
ACC_INTERFACE =

Is an interface, not a class.

0x0200
ACC_ABSTRACT =

Declared abstract; must not be instantiated.

0x0400
ACC_SYNTHETIC =

Declared synthetic; not present in the source code.

0x1000
ACC_ANNOTATION =

Declared as an annotation type.

0x2000
ACC_ENUM =

Declared as an enum type.

0x4000

Instance Attribute Summary collapse

Attributes inherited from Annotatable

#annotations

Instance Method Summary collapse

Methods inherited from Annotatable

#get_annotation, #has_annotation?

Constructor Details

#initialize(major, minor, flags, this_klass, super_klass, interfaces, fields, methods, annotations) ⇒ Class

Returns a new instance of Class.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/java_dissassembler/class.rb', line 14

def initialize(major, minor, flags, this_klass, super_klass, interfaces, fields, methods, annotations)
  super(annotations)
  @major = major
  @minor = minor
  @flags = flags
  @this_klass = this_klass
  @super_klass = super_klass
  @interfaces = interfaces
  @fields = fields
  @methods = methods
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



3
4
5
# File 'lib/java_dissassembler/class.rb', line 3

def fields
  @fields
end

#flagsObject (readonly)

Returns the value of attribute flags.



3
4
5
# File 'lib/java_dissassembler/class.rb', line 3

def flags
  @flags
end

#interfacesObject (readonly)

Returns the value of attribute interfaces.



3
4
5
# File 'lib/java_dissassembler/class.rb', line 3

def interfaces
  @interfaces
end

#methodsObject (readonly)

Returns the value of attribute methods.



3
4
5
# File 'lib/java_dissassembler/class.rb', line 3

def methods
  @methods
end

#super_klassObject (readonly)

Returns the value of attribute super_klass.



3
4
5
# File 'lib/java_dissassembler/class.rb', line 3

def super_klass
  @super_klass
end

#this_klassObject (readonly)

Returns the value of attribute this_klass.



3
4
5
# File 'lib/java_dissassembler/class.rb', line 3

def this_klass
  @this_klass
end

Instance Method Details

#is_abstract?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/java_dissassembler/class.rb', line 42

def is_abstract?
  (@flags & ACC_ABSTRACT) != 0
end

#is_annotation?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/java_dissassembler/class.rb', line 50

def is_annotation?
  (@flags & ACC_ANNOTATION) != 0
end

#is_enum?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/java_dissassembler/class.rb', line 54

def is_enum?
  (@flags & ACC_ENUM) != 0
end

#is_final?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/java_dissassembler/class.rb', line 30

def is_final?
  (@flags & ACC_FINAL) != 0
end

#is_interface?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/java_dissassembler/class.rb', line 38

def is_interface?
  (@flags & ACC_INTERFACE) != 0
end

#is_public?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/java_dissassembler/class.rb', line 26

def is_public?
  (@flags & ACC_PUBLIC) != 0
end

#is_super?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/java_dissassembler/class.rb', line 34

def is_super?
  (@flags & ACC_SUPER) != 0
end

#is_synthetic?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/java_dissassembler/class.rb', line 46

def is_synthetic?
  (@flags & ACC_SYNTHETIC) != 0
end

#java_versionObject



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/java_dissassembler/class.rb', line 58

def java_version
  case @major
  when 46 then "1.2"
  when 47 then "1.3"
  when 48 then "1.4"
  when 49 then "5"
  when 50 then "6"
  when 51 then "7"
  when 52 then "8"
  when 53 then "9"
  end
end