Class: Rasm::Java::FieldInfo
- Inherits:
-
Object
- Object
- Rasm::Java::FieldInfo
- Includes:
- Accessable
- Defined in:
- lib/rasm/java/structure.rb
Constant Summary
Constants included from Accessable
Accessable::ACC_ABSTRACT, Accessable::ACC_ANNOTATION, Accessable::ACC_BRIDGE, Accessable::ACC_DEPRECATED, Accessable::ACC_ENUM, Accessable::ACC_FINAL, Accessable::ACC_INTERFACE, Accessable::ACC_NATIVE, Accessable::ACC_PRIVATE, Accessable::ACC_PROTECTED, Accessable::ACC_PUBLIC, Accessable::ACC_STATIC, Accessable::ACC_STRICT, Accessable::ACC_SUPER, Accessable::ACC_SYNCHRONIZED, Accessable::ACC_SYNTHETIC, Accessable::ACC_TRANSIENT, Accessable::ACC_VARARGS, Accessable::ACC_VOLATILE, Accessable::TYPEPATTERN, Accessable::TYPES
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#descriptor ⇒ Object
readonly
Returns the value of attribute descriptor.
Attributes included from Accessable
Instance Method Summary collapse
- #attribute_of(name) ⇒ Object
-
#initialize(descriptor, attributes) ⇒ FieldInfo
constructor
A new instance of FieldInfo.
- #to_s ⇒ Object
Methods included from Accessable
Constructor Details
#initialize(descriptor, attributes) ⇒ FieldInfo
Returns a new instance of FieldInfo.
8 9 10 |
# File 'lib/rasm/java/structure.rb', line 8 def initialize(descriptor, attributes) @descriptor, @attributes = descriptor, attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/rasm/java/structure.rb', line 7 def attributes @attributes end |
#descriptor ⇒ Object (readonly)
Returns the value of attribute descriptor.
7 8 9 |
# File 'lib/rasm/java/structure.rb', line 7 def descriptor @descriptor end |
Instance Method Details
#attribute_of(name) ⇒ Object
28 29 30 |
# File 'lib/rasm/java/structure.rb', line 28 def attribute_of(name) attributes.detect{|attr| attr.name == name} end |
#to_s ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rasm/java/structure.rb', line 12 def to_s access = access_flags str = '' str << "\t// DEPRECATED\n" if access & ACC_DEPRECATED != 0 str << "\t// access flags 0x%x\n" % access signature, constant_value = attribute_of('Signature'), attribute_of('ConstantValue') if signature str << "\t#{access_desc} #{typeof(signature.value)} #{name}" else str << "\t#{access_desc} #{typeof(descriptor)} #{name}" end str << " = #{constant_value.value}" if constant_value str end |