Module | JavaClass::Dsl::JavaNameFactory |
In: |
lib/javaclass/dsl/java_name_factory.rb
|
Module to mixin to recognize full qualified Java classnames in Ruby code. Packages have to be suffixed with ".*" to be recognized. This is a bit dangerous, as wrong method or variable names with are a valid country code are not recognized as invalid.
Author: | Peter Kofler |
require 'javaclass/dsl/java_name_factory' include JavaNameFactory java.lang.String # => "java.lang.String" java.lang.* # => "java.lang"
method_missing | -> | __top_level_method_missing__ |
Convert the beginning of a full qualified Java classname starting with ‘java’ to a JavaQualifiedName instance.
# File lib/javaclass/dsl/java_name_factory.rb, line 26 def java TemporaryJavaNamePart.new('java') { __top_level_method_missing__(:java) } end
Convert the beginning of a full qualified Java classname to a JavaQualifiedName instance.
# File lib/javaclass/dsl/java_name_factory.rb, line 31 def method_missing(method_id, *args) str = method_id.id2name if JavaLanguage::ALLOWED_PACKAGE_PREFIX.include?(str) TemporaryJavaNamePart.new(str) { __top_level_method_missing__(method_id, args) } else __top_level_method_missing__(method_id, args) end end