class JavaClass::ClassFile::ClassFileAttributes

Class file attributes.

Author

Peter Kofler

Public Class Methods

new(attributes, this_class) click to toggle source
# File lib/javaclass/classfile/class_file_attributes.rb, line 10
def initialize(attributes, this_class)
  @attributes = attributes
  @this_class = this_class
end

Public Instance Methods

anonymous?() click to toggle source
# File lib/javaclass/classfile/class_file_attributes.rb, line 46
def anonymous?
  inner_class? && @this_class =~ /\$\d+$/
end
inner_class?() click to toggle source
# File lib/javaclass/classfile/class_file_attributes.rb, line 27
def inner_class?
  if inner_classes.find { |inner| inner.class_name == @this_class }
    true
  else
    false
  end
end
inner_classes() click to toggle source

List of inner classes Attributes::InnerClass with name and access flags.

# File lib/javaclass/classfile/class_file_attributes.rb, line 22
def inner_classes
  a = @attributes.with('InnerClasses')
  if a then a.inner_classes else [] end
end
outer_class() click to toggle source

Return outer class name for inner classes, or the current class name.

# File lib/javaclass/classfile/class_file_attributes.rb, line 51
def outer_class
  if inner_class?
    JavaVMName.new(@this_class[/^[^$]+/])
  else
    @this_class
  end
end
source_file() click to toggle source

Name of the source file.

# File lib/javaclass/classfile/class_file_attributes.rb, line 16
def source_file
  a = @attributes.with('SourceFile')
  if a then a.source_file else '<not set>' end
end
static_inner_class?() click to toggle source

Defines an accessible inner class, which is a static inner class which is not synthetic.

# File lib/javaclass/classfile/class_file_attributes.rb, line 36
def static_inner_class?
  if inner_classes.find { |inner| inner.class_name == @this_class && 
                                   inner.access_flags.static? && 
                                   (!inner.access_flags.private? || inner.access_flags.protected?) }
    true
  else
    false
  end
end