Class: WindClassProxy
Source Location: /base/WindClassProxy.php
Class WindClassProxy
Class Overview
类代理定义
通过使用类代理机制,可以实现对类方法或属性的监听过滤机制. //相关组件配置,只需设置 proxy为true,就可以通过组件工厂创建一个具有代理功能的类实例对象.
<component name='windApplication' path='WIND:web.WindWebApplication'
scope='singleton' proxy='true'>
<properties>
<property name='dispatcher' ref='dispatcher' />
<property name='handlerAdapter' ref='router' />
</properties>
</component>
$object = Wind::getApp()->getFactory()->getInstance('windApplication');
Located in /base/WindClassProxy.php [line 23]
Author(s):
Information Tags:
|
Properties
|
Methods
|
Methods
WindClassProxy __construct(
[
$targetObject = null], object
$targetObj
)
|
|
Parameters:
object |
$targetObj: |
需要被代理监听的类对象实例 默认为null |
|
$targetObject: |
|
API Tags:
void registerEventListener(
stinrg
$event, object
$listener, [string
$type = self::EVENT_TYPE_METHOD]
)
|
|
注册事件以及事件监听类
通过调用该方法,将事件以及对事件的监听方法注册进来,当事件方法被调用的时候监听的方法被触发.例: <component name='windApplication' path='WIND:web.WindWebApplication'
scope='singleton' proxy='true'>...</component>
$object = Wind::getApp()->getFactory()->getInstance('windApplication');
Parameters:
stinrg |
$event: |
被监听的事件 |
object |
$listener: |
事件监听器 |
string |
$type: |
事件监听类型 |
API Tags:
注册目标对象,如果已经注册了不重复注册
WindFactory中创建类代理的一段例子: $instance = new Object();
$this->addClassDefinitions($alias, array('path' => $proxy, 'scope' => 'prototype'));
$proxy = $this->getInstance($alias);
$instance->_proxy = $proxy;
<note>注意:$instance继承自WindModule</note>
Parameters:
API Tags:
返回当前代理对象的真实类的路径信息
API Tags:
void _setClassName(
string
$className
)
|
|
设置类名称
Parameters:
API Tags:
void _setClassPath(
string
$classPath
)
|
|
设置类路径
Parameters:
API Tags:
mixed __call(
string
$methodName, array
$args
)
|
|
监听类方法
Parameters:
string |
$methodName: |
方法名 |
array |
$args: |
方法参数 |
API Tags:
Information Tags:
mixed __get(
string
$propertyName
)
|
|
监听属性调用
Parameters:
string |
$propertyName: |
属性名 |
API Tags:
Deprecated: | |
Access: | public |
mixed __set(
string
$propertyName, mixed
$value
)
|
|
该方法用于监听类属性
Parameters:
string |
$propertyName: |
属性名称 |
mixed |
$value: |
属性值 |
API Tags:
Deprecated: | |
Access: | public |
Information Tags:
|
|