phpDocumentor base
[ class tree: base ] [ index: base ] [ all elements ]

Class: WindClassProxy

Source Location: /base/WindClassProxy.php

Class WindClassProxy

Class Overview

类代理定义

通过使用类代理机制,可以实现对类方法或属性的监听过滤机制.

  1.  //相关组件配置,只需设置 proxy为true,就可以通过组件工厂创建一个具有代理功能的类实例对象.
  2.  <component name='windApplication' path='WIND:web.WindWebApplication'
  3.  scope='singleton' proxy='true'>
  4.  <properties>
  5.  <property name='dispatcher' ref='dispatcher' />
  6.  <property name='handlerAdapter' ref='router' />
  7.  </properties>
  8.  </component>
  9.  $object Wind::getApp()->getFactory()->getInstance('windApplication');
  10.  $object->registerEventListener('runProcess'new Listener());

Located in /base/WindClassProxy.php [line 23]



		
				Author(s):
		
		
		
Information Tags:
Version:  $Id: WindClassProxy.php 2973 2011-10-15 19:22:48Z yishuo $
Copyright:  ©2003-2103 phpwind.com
License:  http://www.windframework.com

Properties

Methods

[ Top ]
Property Summary
mixed   $_className  
mixed   $_classPath  
mixed   $_instance  
mixed   $_listener  

[ Top ]
Method Summary
WindClassProxy   __construct()  
void   registerEventListener()   注册事件以及事件监听类
WindClassProxy   registerTargetObject()   注册目标对象,如果已经注册了不重复注册
string   _getClassName()   返回当前代理对象的真实类名称
string   _getClassPath()   返回当前代理对象的真实类的路径信息
object   _getInstance()   返回当前代理对象的真实类对象
void   _setClassName()   设置类名称
void   _setClassPath()   设置类路径
mixed   __call()   监听类方法
mixed   __get()   监听属性调用
mixed   __set()   该方法用于监听类属性

[ Top ]
Properties
mixed   $_className = '' [line 40]
API Tags:
Access:  protected


[ Top ]
mixed   $_classPath = '' [line 41]
API Tags:
Access:  protected


[ Top ]
mixed   $_instance = null [line 42]
API Tags:
Access:  protected


[ Top ]
mixed   $_listener = array() [line 43]
API Tags:
Access:  protected


[ Top ]
Methods
Constructor __construct  [line 48]

  WindClassProxy __construct( [ $targetObject = null], object $targetObj  )

Parameters:
object   $targetObj:  需要被代理监听的类对象实例 默认为null
   $targetObject: 

API Tags:
Access:  public


[ Top ]
registerEventListener  [line 66]

  void registerEventListener( stinrg $event, object $listener, [string $type = self::EVENT_TYPE_METHOD]  )

注册事件以及事件监听类

通过调用该方法,将事件以及对事件的监听方法注册进来,当事件方法被调用的时候监听的方法被触发.例:

  1.  <component name='windApplication' path='WIND:web.WindWebApplication'
  2.  scope='singleton' proxy='true'>...</component>
  3.  $object Wind::getApp()->getFactory()->getInstance('windApplication');
  4.  $object->registerEventListener('runProcess'new Listener());

Parameters:
stinrg   $event:  被监听的事件
object   $listener:  事件监听器
string   $type:  事件监听类型

API Tags:
Access:  public


[ Top ]
registerTargetObject  [line 87]

  WindClassProxy registerTargetObject( object $targetObject  )

注册目标对象,如果已经注册了不重复注册

WindFactory中创建类代理的一段例子:

  1.  $instance new Object();
  2.  $this->addClassDefinitions($aliasarray('path' => $proxy'scope' => 'prototype'));
  3.  $proxy $this->getInstance($alias);
  4.  $proxy->registerTargetObject($instance);
  5.  $instance->_proxy $proxy;
<note>注意:$instance继承自WindModule</note>

Parameters:
object   $targetObject: 

API Tags:
Access:  public


[ Top ]
_getClassName  [line 205]

  string _getClassName( )

返回当前代理对象的真实类名称


API Tags:
Access:  public


[ Top ]
_getClassPath  [line 214]

  string _getClassPath( )

返回当前代理对象的真实类的路径信息


API Tags:
Access:  public


[ Top ]
_getInstance  [line 196]

  object _getInstance( )

返回当前代理对象的真实类对象


API Tags:
Access:  public


[ Top ]
_setClassName  [line 224]

  void _setClassName( string $className  )

设置类名称

Parameters:
string   $className: 

API Tags:
Access:  public


[ Top ]
_setClassPath  [line 234]

  void _setClassPath( string $classPath  )

设置类路径

Parameters:
string   $classPath: 

API Tags:
Access:  public


[ Top ]
__call  [line 147]

  mixed __call( string $methodName, array $args  )

监听类方法

Parameters:
string   $methodName:  方法名
array   $args:  方法参数

API Tags:
Access:  public

Information Tags:
Throws:  WindException

[ Top ]
__get  [line 126]

  mixed __get( string $propertyName  )

监听属性调用

Parameters:
string   $propertyName:  属性名

API Tags:
Deprecated:  
Access:  public


[ Top ]
__set  [line 106]

  mixed __set( string $propertyName, mixed $value  )

该方法用于监听类属性

Parameters:
string   $propertyName:  属性名称
mixed   $value:  属性值

API Tags:
Deprecated:  
Access:  public

Information Tags:
Throws:  WindException

[ Top ]
Constants
EVENT_TYPE_GETTER = 'getter' [line 26]

[ Top ]
EVENT_TYPE_METHOD = 'method' [line 24]

[ Top ]
EVENT_TYPE_SETTER = 'setter' [line 25]

[ Top ]

Documentation generated on Fri, 30 Mar 2012 11:43:28 +0800 by phpDocumentor 1.4.4