module JavaClass::Dsl::JavaNameFactory

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

Usage

require 'javaclass/dsl/java_name_factory'
include JavaNameFactory

java.lang.String      # => "java.lang.String"
java.lang.*           # => "java.lang"

Public Instance Methods

__top_level_method_missing__(method_id, *args)
Alias for: method_missing
java() click to toggle source

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
method_missing(method_id, *args) click to toggle source

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
Also aliased as: __top_level_method_missing__