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
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
(also: #to_s)
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.
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.
30 31 32 |
# File 'lib/javaclass/classfile/constants/single_reference.rb', line 30 def dump super + "##{@first_index};\t// #{to_s}" end |
#first_value ⇒ Object Also known as: to_s
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 |