class Squash::Java::Method
Represents a Java instance method. Polymorphism is handled by using separate Method
instances with different {#arguments} values.
Attributes
arguments[R]
@return [Array<Squash::Java::Argument>] The method arguments.
klass[R]
@return [Squash::Java::Class] The class owning this method.
name[R]
@return [String] The method name.
obfuscation[R]
@return [String, nil] The obfuscated method name.
return_type[R]
@return [Squash::Java::Argument] The type of object returned.
Public Class Methods
new(klass, name, return_type, *arguments)
click to toggle source
@private
# File lib/squash/java/namespace.rb, line 494 def initialize(klass, name, return_type, *arguments) @klass = klass @name = name @return_type = return_type @arguments = arguments klass.java_methods << self end
Public Instance Methods
add_argument(type)
click to toggle source
@private
# File lib/squash/java/namespace.rb, line 503 def add_argument(type) @arguments << type @arguments.size - 1 end
full_name()
click to toggle source
@return [String] The full method name, along with return value and arguments
as full type names.
# File lib/squash/java/namespace.rb, line 511 def full_name args = arguments.map { |type| type.to_s }.join(', ') "#{return_type.to_s} #{name}(#{args})" end
inspect()
click to toggle source
@private
# File lib/squash/java/namespace.rb, line 517 def inspect() "#<#{self.class.to_s} #{full_name}>" end
obfuscation=(name)
click to toggle source
Sets the method's obfuscation. @raise [ArgumentError] If the obfuscation is taken by another method in
the same class.
# File lib/squash/java/namespace.rb, line 486 def obfuscation=(name) if (meth = klass.java_methods.detect { |m| m.arguments == arguments && m.obfuscation == name }) raise ArgumentError, "Tried to assign obfuscation #{name} to #{meth.inspect} and #{inspect}" end @obfuscation = name end