Class: Cheri::Java::Builder::PackageFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/cheri/java/builder/main.rb

Overview

GenericBuilderFactory

Constant Summary collapse

Dot =

:stopdoc:

'.'
CJ =
Cheri::Java
BuildType =
Cheri::Builder::BuildType
BuildTypes =
Cheri::Builder::BuildTypes

Instance Method Summary collapse

Constructor Details

#initialize(pkg_str, mod) ⇒ PackageFactory

Util = Cheri::Java::Builder::Util :startdoc:



411
412
413
414
415
416
# File 'lib/cheri/java/builder/main.rb', line 411

def initialize(pkg_str,mod)
  raise Cheri.type_error(pkg_str,String) unless String === pkg_str
  @pkg = pkg_str.empty? || pkg_str[-1] == ?. ? pkg_str.dup : pkg_str + Dot
  @mod = mod
  @types = BuildTypes.new
end

Instance Method Details

#builder(ctx, sym, *r, &k) ⇒ Object



417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/cheri/java/builder/main.rb', line 417

def builder(ctx,sym,*r,&k)
  unless type = @types[sym]
    if clazz = CJ.get_class(@pkg + Util.cc(sym)) rescue nil
      type = @types[sym] = BuildType.new(clazz,sym)
    else
      type = @types[sym] = :none
    end
  end
  unless type == :none
    GenericClassBuilder.new(@mod,type,ctx,sym,*r,&k)
  else
    nil
  end
end