Class: Duby::JavaSource::InterfaceBuilder
- Inherits:
-
ClassBuilder
- Object
- ClassBuilder
- Duby::JavaSource::InterfaceBuilder
- Defined in:
- lib/duby/jvm/source_generator/builder.rb
Instance Attribute Summary
Attributes inherited from ClassBuilder
#class_name, #filename, #interfaces, #name, #out, #package, #superclass
Instance Method Summary collapse
- #finish_declaration ⇒ Object
-
#initialize(builder, name, interfaces) ⇒ InterfaceBuilder
constructor
A new instance of InterfaceBuilder.
- #public_method(name, type, exceptions, *args) ⇒ Object
Methods inherited from ClassBuilder
#compiler, #declare_field, #generate, #main, #public_constructor, #public_static_method, #start, #stop
Methods included from Compiler::JVM::JVMLogger
Methods included from Helper
#annotate, #block, #dedent, #indent, #init_value, #print, #puts
Constructor Details
#initialize(builder, name, interfaces) ⇒ InterfaceBuilder
Returns a new instance of InterfaceBuilder.
254 255 256 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 254 def initialize(builder, name, interfaces) super(builder, name, nil, interfaces) end |
Instance Method Details
#finish_declaration ⇒ Object
258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 258 def finish_declaration return if @declaration_finished @declaration_finished = true print "public interface #{class_name}" unless @interfaces.empty? print " extends " @interfaces.each_with_index do |interface, index| print ', ' unless index == 0 print interface.to_source end end puts " {" indent end |
#public_method(name, type, exceptions, *args) ⇒ Object
273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 273 def public_method(name, type, exceptions, *args) finish_declaration type ||= Duby::AST::type(:void) @methods << MethodBuilder.new(self, :name => name, :return => type, :args => args, :abstract => true, :exceptions => exceptions) @methods[-1] end |