Class: JavaClass::ClassFile::Constants::Base
- Defined in:
- lib/javaclass/classfile/constants/base.rb
Overview
Superclass of all constant values in the constant pool. Every constant has a name
, a tag
and a size
in bytes.
- Author
-
Peter Kofler
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
ZenTest FULL to find method name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#slots ⇒ Object
readonly
Returns the value of attribute slots.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
-
#const_class? ⇒ Boolean
Return false for sanity check if it’s a class.
-
#const_field? ⇒ Boolean
Return false for sanity check if it’s a field.
-
#const_method? ⇒ Boolean
Return false for sanity check if it’s a method.
-
#dump ⇒ Object
Return part of debug output.
-
#initialize(name = nil) ⇒ Base
constructor
Set default constants.
Constructor Details
#initialize(name = nil) ⇒ Base
Set default constants.
20 21 22 23 24 25 26 27 28 |
# File 'lib/javaclass/classfile/constants/base.rb', line 20 def initialize(name=nil) if name @name = name else @name = self.class.to_s[/::[^:]+$/][10..-1] # skip modules (::) and "Constant" end @size = 3 @slots = 1 end |
Instance Attribute Details
#name ⇒ Object (readonly)
ZenTest FULL to find method name
14 15 16 |
# File 'lib/javaclass/classfile/constants/base.rb', line 14 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
16 17 18 |
# File 'lib/javaclass/classfile/constants/base.rb', line 16 def size @size end |
#slots ⇒ Object (readonly)
Returns the value of attribute slots.
17 18 19 |
# File 'lib/javaclass/classfile/constants/base.rb', line 17 def slots @slots end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
15 16 17 |
# File 'lib/javaclass/classfile/constants/base.rb', line 15 def tag @tag end |
Instance Method Details
#const_class? ⇒ Boolean
Return false for sanity check if it’s a class. Subclasses should overwrite.
36 37 38 |
# File 'lib/javaclass/classfile/constants/base.rb', line 36 def const_class? false end |
#const_field? ⇒ Boolean
Return false for sanity check if it’s a field. Subclasses should overwrite.
41 42 43 |
# File 'lib/javaclass/classfile/constants/base.rb', line 41 def const_field? false end |
#const_method? ⇒ Boolean
Return false for sanity check if it’s a method. Subclasses should overwrite.
46 47 48 |
# File 'lib/javaclass/classfile/constants/base.rb', line 46 def const_method? false end |
#dump ⇒ Object
Return part of debug output.
31 32 33 |
# File 'lib/javaclass/classfile/constants/base.rb', line 31 def dump "#{@name}\t" # #{@tag} end |