Class: JavaClass::ClassFile::Constants::SingleReference
- Defined in:
- lib/javaclass/classfile/constants/single_reference.rb
Overview
Superclass of single reference constants like ConstantClass
(Class
) in the constant pool.
- Author
-
Peter Kofler
Direct Known Subclasses
ConstantClass, ConstantInvokeDynamic, ConstantMethodHandle, ConstantMethodType, ConstantModule, ConstantPackage, ConstantString, DoubleReference
Instance Attribute Summary collapse
-
#first_index ⇒ Object
readonly
Returns the value of attribute first_index.
Attributes inherited from Base
Instance Method Summary collapse
-
#dump ⇒ Object
Return part of debug output.
-
#first_value ⇒ Object
Return the value, which is the referenced value from the pool.
-
#initialize(pool, data, start, name = nil) ⇒ SingleReference
constructor
Define a single reference into pool from data beginning at start.
- #to_s ⇒ Object
Methods inherited from Base
#const_class?, #const_field?, #const_method?
Constructor Details
#initialize(pool, data, start, name = nil) ⇒ SingleReference
Define a single reference into pool from data beginning at start
15 16 17 18 19 20 21 |
# File 'lib/javaclass/classfile/constants/single_reference.rb', line 15 def initialize(pool, data, start, name=nil) super(name) @tag = data.u1(start) @enclosing_pool = pool @first_index = data.u2(start+1) end |
Instance Attribute Details
#first_index ⇒ Object (readonly)
Returns the value of attribute first_index.
12 13 14 |
# File 'lib/javaclass/classfile/constants/single_reference.rb', line 12 def first_index @first_index end |
Instance Method Details
#dump ⇒ Object
Return part of debug output.
32 33 34 |
# File 'lib/javaclass/classfile/constants/single_reference.rb', line 32 def dump super + "##{@first_index};\t// #{to_s}" end |
#first_value ⇒ Object
Return the value, which is the referenced value from the pool.
24 25 26 |
# File 'lib/javaclass/classfile/constants/single_reference.rb', line 24 def first_value get(@first_index) end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/javaclass/classfile/constants/single_reference.rb', line 27 def to_s first_value end |