Class: Guff::JavaSource::Method
- Inherits:
-
Constructor
- Object
- Constructor
- Guff::JavaSource::Method
- Includes:
- AnnotationSupport, ModifierSupport, ScopeSupport
- Defined in:
- lib/guff/java_source.rb
Instance Method Summary collapse
-
#initialize(owning_class, name) ⇒ Method
constructor
A new instance of Method.
- #return_type ⇒ Object
- #returns(t) ⇒ Object
- #returns_list_of(t) ⇒ Object
- #throws(e) ⇒ Object
- #write_declaration(writer) ⇒ Object
Methods included from ScopeSupport
#package_local, #private, #protected, #public
Methods included from ModifierSupport
#abstract, #final, #modifiers, #static
Methods included from AnnotationSupport
#add_annotation, #annotations, #write_annotations_to
Methods inherited from Constructor
#add_assignment_for_field_name, #add_takes_clause_for_field, #body, #for_field, #for_fields, #write_to
Methods included from ArgumentsHelper
Methods included from ParameterSupport
#parameters, #parameters_list, #takes, #taking
Methods included from JavadocSupport
#add_javadoc, #javadoc_lines, #write_javadoc_to
Methods included from ThrowsSupport
#append_throws_clause, #exceptions
Methods included from ClassMember
Constructor Details
#initialize(owning_class, name) ⇒ Method
Returns a new instance of Method.
384 385 386 387 388 389 |
# File 'lib/guff/java_source.rb', line 384 def initialize(owning_class,name) super(owning_class,name) @return_type = 'void' @exceptions = [] @scope = 'public' end |
Instance Method Details
#return_type ⇒ Object
406 407 408 |
# File 'lib/guff/java_source.rb', line 406 def return_type @return_type end |
#returns(t) ⇒ Object
391 392 393 394 |
# File 'lib/guff/java_source.rb', line 391 def returns(t) @return_type = t self end |
#returns_list_of(t) ⇒ Object
401 402 403 404 |
# File 'lib/guff/java_source.rb', line 401 def returns_list_of(t) @return_type= "List<#{t}>" self end |
#throws(e) ⇒ Object
396 397 398 399 |
# File 'lib/guff/java_source.rb', line 396 def throws(e) @exceptions << e self end |
#write_declaration(writer) ⇒ Object
411 412 413 |
# File 'lib/guff/java_source.rb', line 411 def write_declaration(writer) writer.word(@scope).words(modifiers).word(@return_type).word("#{@name}(").append(parameters_list).append(")") end |