Class JavaClass::ClassFile::Constants::Base
In: lib/javaclass/classfile/constants/base.rb
Parent: Object

Superclass of all constant values in the constant pool. Every constant has a name, a tag and a size in bytes.

Author:Peter Kofler

Methods

Attributes

name  [R] 
size  [R] 
slots  [R] 
tag  [R] 

Public Class methods

Set default constants.

[Source]

# 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

Public Instance methods

Return false for sanity check if it‘s a class. Subclasses should overwrite.

[Source]

# File lib/javaclass/classfile/constants/base.rb, line 36
        def const_class?
          false
        end

Return false for sanity check if it‘s a field. Subclasses should overwrite.

[Source]

# File lib/javaclass/classfile/constants/base.rb, line 41
        def const_field?
          false
        end

Return false for sanity check if it‘s a method. Subclasses should overwrite.

[Source]

# File lib/javaclass/classfile/constants/base.rb, line 46
        def const_method?
          false
        end

Return part of debug output.

[Source]

# File lib/javaclass/classfile/constants/base.rb, line 31
        def dump
          "#{@name}\t" # #{@tag}
        end

[Validate]