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
-
#initialize(builder, name, interfaces) ⇒ InterfaceBuilder
constructor
A new instance of InterfaceBuilder.
- #public_method(name, type, exceptions, *args) ⇒ Object
- #start ⇒ Object
Methods inherited from ClassBuilder
#compiler, #declare_field, #generate, #main, #public_constructor, #public_static_method, #stop
Methods included from Compiler::JVM::JVMLogger
Methods included from Helper
#block, #dedent, #indent, #init_value, #print, #puts
Constructor Details
#initialize(builder, name, interfaces) ⇒ InterfaceBuilder
Returns a new instance of InterfaceBuilder.
234 235 236 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 234 def initialize(builder, name, interfaces) super(builder, name, nil, interfaces) end |
Instance Method Details
#public_method(name, type, exceptions, *args) ⇒ Object
253 254 255 256 257 258 259 260 261 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 253 def public_method(name, type, exceptions, *args) @methods << MethodBuilder.new(self, :name => name, :return => type, :args => args, :abstract => true, :exceptions => exceptions) @methods[-1] end |
#start ⇒ Object
238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 238 def start puts "// Generated from #{@builder.filename}" puts "package #{package};" if package 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 |