class JavaClass::JavaClassFileName
A Java class file name from the file system. That is a/b/C.class
. These names are read from the FolderClasspath.
- Author
-
Peter Kofler
Constants
- SEPARATOR
- SEPARATOR_REGEX
- VALID_REGEX
Attributes
file_name[R]
The plain file name of this class file.
Public Class Methods
new(string, qualified=nil)
click to toggle source
Create a new class file name string with optional qualified class which may be available.
Calls superclass method
# File lib/javaclass/java_name.rb, line 296 def initialize(string, qualified=nil) super string if string =~ VALID_REGEX @file_name = string.gsub(SEPARATOR_REGEX, SEPARATOR) else raise ArgumentError, "#{string} is no valid class file name" end @qualified_name = qualified @jvm_name = nil end
valid?(string)
click to toggle source
Is string a valid class file name?
# File lib/javaclass/java_name.rb, line 288 def self.valid?(string) string =~ VALID_REGEX end
Public Instance Methods
to_class_file()
click to toggle source
# File lib/javaclass/java_name.rb, line 333 def to_class_file self end
to_classname()
click to toggle source
# File lib/javaclass/java_name.rb, line 307 def to_classname return @qualified_name if @qualified_name new_val = JavaQualifiedName.new( @file_name.gsub(SEPARATOR_REGEX, JavaLanguage::SEPARATOR).sub(JavaLanguage::CLASS_REGEX, ''), nil, self) if frozen? new_val else @qualified_name = new_val end end
to_java_file()
click to toggle source
# File lib/javaclass/java_name.rb, line 329 def to_java_file @file_name.sub(JavaLanguage::CLASS_REGEX, JavaLanguage::SOURCE) end
to_jvmname()
click to toggle source
# File lib/javaclass/java_name.rb, line 319 def to_jvmname return @jvm_name if @jvm_name new_val = JavaVMName.new(@file_name.sub(JavaLanguage::CLASS_REGEX, ''), @qualified_name) if frozen? new_val else @jvm_name = new_val end end