Module: BiteScript::AnnotationBuilder

Includes:
Signature
Defined in:
lib/bitescript/builder.rb,
lib/bitescript/asm3/builder.rb

Instance Method Summary collapse

Methods included from Signature

ci, class_id, classname, path, sig, signature, tipath, type_insn_path

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, val) ⇒ Object



612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
# File 'lib/bitescript/builder.rb', line 612

def method_missing(name, val)
  name_str = name.to_s
  if name_str[-1] == ?=
    name_str = name_str[0..-2]
    if Array === val
      array(name_str) do |ary|
        val.each {|x| ary.visit(nil, x)}
      end
    else
      visit name_str, val
    end
  else
    super
  end
end

Instance Method Details

#annotation(name, cls) {|sub_annotation| ... } ⇒ Object

Yields:

  • (sub_annotation)


630
631
632
633
634
635
636
637
638
639
640
641
# File 'lib/bitescript/builder.rb', line 630

def annotation(name, cls)
  if Java::JavaClass === cls || BiteScript::ASM::Type === cls || BiteScript::ClassMirror === cls
    java_class = cls
  else
    java_class = cls.java_class
  end

  sub_annotation = visit_annotation(name, ci(java_class))
  sub_annotation.extend AnnotationBuilder
  yield sub_annotation
  sub_annotation.visit_end
end

#array(name) {|sub_annotation| ... } ⇒ Object

Yields:

  • (sub_annotation)


642
643
644
645
646
647
# File 'lib/bitescript/builder.rb', line 642

def array(name)
  sub_annotation = visit_array(name)
  sub_annotation.extend AnnotationBuilder
  yield sub_annotation
  sub_annotation.visit_end
end

#enum(name, cls, value) ⇒ Object



648
649
650
651
652
653
654
655
656
# File 'lib/bitescript/builder.rb', line 648

def enum(name, cls, value)
  if JavaClass == cls
    java_class = cls
  else
    java_class = cls.java_class
  end

  visit_enum(name, ci(java_class), value)
end

#value(k, v) ⇒ Object



627
628
629
# File 'lib/bitescript/builder.rb', line 627

def value(k, v)
  visit k, v
end