Class: Squash::Java::Method
- Inherits:
-
Object
- Object
- Squash::Java::Method
- Defined in:
- lib/squash/java/namespace.rb
Overview
Represents a Java instance method. Polymorphism is handled by using separate Method instances with different #arguments values.
Instance Attribute Summary collapse
-
#arguments ⇒ Array<Squash::Java::Argument>
readonly
The method arguments.
-
#klass ⇒ Squash::Java::Class
readonly
The class owning this method.
-
#name ⇒ String
readonly
The method name.
-
#obfuscation ⇒ String?
The obfuscated method name.
-
#return_type ⇒ Squash::Java::Argument
readonly
The type of object returned.
Instance Method Summary collapse
- #add_argument(type) ⇒ Object
-
#full_name ⇒ String
The full method name, along with return value and arguments as full type names.
-
#initialize(klass, name, return_type, *arguments) ⇒ Method
constructor
A new instance of Method.
- #inspect ⇒ Object
Constructor Details
#initialize(klass, name, return_type, *arguments) ⇒ Method
Returns a new instance of Method.
494 495 496 497 498 499 500 |
# 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 |
Instance Attribute Details
#arguments ⇒ Array<Squash::Java::Argument> (readonly)
Returns The method arguments.
477 478 479 |
# File 'lib/squash/java/namespace.rb', line 477 def arguments @arguments end |
#klass ⇒ Squash::Java::Class (readonly)
Returns The class owning this method.
468 469 470 |
# File 'lib/squash/java/namespace.rb', line 468 def klass @klass end |
#name ⇒ String (readonly)
Returns The method name.
474 475 476 |
# File 'lib/squash/java/namespace.rb', line 474 def name @name end |
#obfuscation ⇒ String?
Returns The obfuscated method name.
480 481 482 |
# File 'lib/squash/java/namespace.rb', line 480 def obfuscation @obfuscation end |
#return_type ⇒ Squash::Java::Argument (readonly)
Returns The type of object returned.
471 472 473 |
# File 'lib/squash/java/namespace.rb', line 471 def return_type @return_type end |
Instance Method Details
#add_argument(type) ⇒ Object
503 504 505 506 |
# File 'lib/squash/java/namespace.rb', line 503 def add_argument(type) @arguments << type @arguments.size - 1 end |
#full_name ⇒ String
Returns The full method name, along with return value and arguments as full type names.
511 512 513 514 |
# 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 ⇒ Object
517 |
# File 'lib/squash/java/namespace.rb', line 517 def inspect() "#<#{self.class.to_s} #{full_name}>" end |