Module: BiteScript::AnnotationBuilder
- Includes:
- Signature
- Defined in:
- lib/bitescript/builder.rb
Instance Method Summary
collapse
Methods included from Signature
ci, class_id, classname, path, sig, signature
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, val) ⇒ Object
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
|
# File 'lib/bitescript/builder.rb', line 539
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
557
558
559
560
561
562
563
564
565
566
567
568
|
# File 'lib/bitescript/builder.rb', line 557
def annotation(name, cls)
if Java::JavaClass === 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
569
570
571
572
573
574
|
# File 'lib/bitescript/builder.rb', line 569
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
575
576
577
578
579
580
581
582
583
|
# File 'lib/bitescript/builder.rb', line 575
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
554
555
556
|
# File 'lib/bitescript/builder.rb', line 554
def value(k, v)
visit k, v
end
|