Class JavaClass::ClassFile::Constants::Value
In: lib/javaclass/classfile/constants/value.rb
Parent: Base

Superclass of value constants like ConstantInt (Integer) in the constant pool.

Author:Peter Kofler

Methods

Attributes

value  [R] 

Public Class methods

Create a constant value with an optional downcase name

[Source]

# File lib/javaclass/classfile/constants/value.rb, line 14
        def initialize(name=self.class.to_s[/::[^:]+$/][10..-1].downcase)
          super(name)
        end

Public Instance methods

Return part of debug output.

[Source]

# File lib/javaclass/classfile/constants/value.rb, line 24
        def dump
          super + to_s
        end

Return the value as string.

[Source]

# File lib/javaclass/classfile/constants/value.rb, line 19
        def to_s
          @value.to_s
        end

Protected Instance methods

Define a value from data beginning at position start with the size in bytes and slots (1 or 2).

[Source]

# File lib/javaclass/classfile/constants/value.rb, line 31
        def get_value(data, start, size, slots=1)
          @tag = data.u1(start)
          @size = size
          @slots = slots

          data[start+1..start+size-1]
        end

Dummy method to "fix" unused warning of param pool in Eclipse.

[Source]

# File lib/javaclass/classfile/constants/value.rb, line 40
        def silence_unused_warning(pool)
          raise ArgumentError, 'pool is nil' unless pool
        end

[Validate]