Class: Seasar::Aop::MethodInvocation

Inherits:
Object
  • Object
show all
Defined in:
lib/seasar/aop/method-invocation.rb

Overview

アスペクトされたインターセプターを管理・実行するクラスです。 アスペクトされたメソッドが実行される度にインスタンス化されます。

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMethodInvocation

MethodInvocationを構築します。

  • args

    • none



28
29
30
31
32
33
34
35
36
# File 'lib/seasar/aop/method-invocation.rb', line 28

def initialize
  @index = 0
  @method = nil
  @interceptors = nil
  @enhanced_class = nil
  @component_class = nil
  @args = nil
  @this = nil
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



37
38
39
# File 'lib/seasar/aop/method-invocation.rb', line 37

def args
  @args
end

#component_classObject

Returns the value of attribute component_class.



37
38
39
# File 'lib/seasar/aop/method-invocation.rb', line 37

def component_class
  @component_class
end

#enhanced_classObject

Returns the value of attribute enhanced_class.



37
38
39
# File 'lib/seasar/aop/method-invocation.rb', line 37

def enhanced_class
  @enhanced_class
end

#interceptorsObject

Returns the value of attribute interceptors.



37
38
39
# File 'lib/seasar/aop/method-invocation.rb', line 37

def interceptors
  @interceptors
end

#methodObject

Returns the value of attribute method.



37
38
39
# File 'lib/seasar/aop/method-invocation.rb', line 37

def method
  @method
end

#procedureObject

Returns the value of attribute procedure.



37
38
39
# File 'lib/seasar/aop/method-invocation.rb', line 37

def procedure
  @procedure
end

#thisObject

Returns the value of attribute this.



37
38
39
# File 'lib/seasar/aop/method-invocation.rb', line 37

def this
  @this
end

Instance Method Details

#proceedObject

MethodInvocation自身および、保持しているインターセプタから呼び出されます。 すべてのインターセプタが実行されたのちにターゲットメソッドが実行されます。

  • args

    • none

  • return

    • mixed



47
48
49
50
51
52
53
54
# File 'lib/seasar/aop/method-invocation.rb', line 47

def proceed
  if @index < @interceptors.length
    @index += 1
    return @interceptors[@index - 1].call(self)
  else
    return @method.call(*@args, &@procedure)
  end
end