Class: Java::Annotatable
- Inherits:
-
Object
- Object
- Java::Annotatable
- Defined in:
- lib/java_dissassembler/annotatable.rb
Instance Attribute Summary collapse
-
#annotations ⇒ Object
readonly
Returns the value of attribute annotations.
Instance Method Summary collapse
- #get_annotation(annotation_name) ⇒ Object
- #has_annotation?(annotation_name) ⇒ Boolean
-
#initialize(annotations) ⇒ Annotatable
constructor
A new instance of Annotatable.
Constructor Details
#initialize(annotations) ⇒ Annotatable
Returns a new instance of Annotatable.
4 5 6 |
# File 'lib/java_dissassembler/annotatable.rb', line 4 def initialize(annotations) @annotations = annotations end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
3 4 5 |
# File 'lib/java_dissassembler/annotatable.rb', line 3 def annotations @annotations end |
Instance Method Details
#get_annotation(annotation_name) ⇒ Object
12 13 14 15 |
# File 'lib/java_dissassembler/annotatable.rb', line 12 def get_annotation(annotation_name) hash = @annotations.find { |a| a.keys.include?(annotation_name) } hash[annotation_name] unless hash.nil? end |
#has_annotation?(annotation_name) ⇒ Boolean
8 9 10 |
# File 'lib/java_dissassembler/annotatable.rb', line 8 def has_annotation?(annotation_name) @annotations.any? { |hash| hash.keys.any? { |key| key == annotation_name } } end |