liguofeng29’s blog

個人勉強用ブログだっす。

S2AOP - InterType

 InterTypeはクラスの静的な構造(フィールド追加、メソッド追加)を変更することができます。

 

S2AOPとして提供しているInterType - PropertyInterType

 

a. フィールドに対するsetter,getterが追加できる。

b. <interType>タグを使う

c. protected, publicフィールドである必要がある。

 

InterTypeのクループ

<!-- コンポーネント定義 --> 
<component name="interType1" ... />
<component name="interType2" ... /> 
 
<!-- グループ化 --> 
<component name="chain" class="org.seasar.framework.aop.intertyper.InterTypeChain">
    <initMethod name="add"><arg>interType1</arg></initMethod>
    <initMethod name="add"><arg>interType2</arg></initMethod> 
</component>
 
<!-- InterType適用 --> 
<component .....>
    <interType>chain</interType> 
</component>