Module: Guff::JavaSource::AnnotationSupport

Included in:
Class, Constructor, Field, Method
Defined in:
lib/guff/java_source.rb

Instance Method Summary collapse

Instance Method Details

#add_annotation(type, value = nil) {|annotation| ... } ⇒ Object

Yields:

  • (annotation)


47
48
49
50
51
52
# File 'lib/guff/java_source.rb', line 47

def add_annotation(type, value=nil)
    annotation = Annotation.new(type, value)
    annotations << annotation
    yield annotation if block_given?
    self
end

#annotationsObject



54
55
56
# File 'lib/guff/java_source.rb', line 54

def annotations
    @annotations ||= []
end

#write_annotations_to(writer) ⇒ Object



58
59
60
61
62
63
# File 'lib/guff/java_source.rb', line 58

def write_annotations_to(writer)
    annotations.each {|a|
        a.write_to(writer)
        writer.new_line
    }
end