public class ConstantAnnotationHandler extends AbstractAnnotationHandler
定数アノテーションとはpublic,static,finalを用いて記述されたフィールドの事です。
フィールドのキーと値は次の形式で指定します。
key1=value1,key2=value2,key3=value3....指定出来るキーとその値はそれぞれの定数アノテーションで説明します。 一部の定数アノテーションのフィールドにはキーとその値を指定することが出来ないものもあります。 フィールドの値が不正な場合は
IllegalArgumentExceptionをスローします。
Componentアノテーション
Componentアノテーションは、フィールド名がCOMPONENTでString型のフィールドです。
Componentアノテーションであるフィールドに指定出来るキーは以下になります。
nameinstanceautoBindingexternalBinding指定されたキーとその値に従ってコンポーネント定義を作成します。
Bindingアノテーション
Bindingアノテーションは、フィールド名がプロパティ名_BINDINGでString型のフィールドです。
Bindingアノテーションであるフィールドに指定出来るキーは以下になります。
bindingTypevalueBindingアノテーションのフィールドにはnullやONGL式を直接指定することも出来ます。
指定されたキーとその値に従ってプロパティ定義を作成します。
AspectアノテーションAspectアノテーションは、フィールド名がASPECTでString型のフィールドです。
Aspectアノテーションであるフィールドに指定出来るキーは以下になります。
valuepointcut指定されたキーとその値に従ってアスペクト定義を作成します。
InterTypeアノテーション
InterTypeアノテーションは、フィールド名がINTER_TYPEでString型のフィールドです。
InterTypeアノテーションであるフィールドには、ONGL式を指定します。
指定されたONGL式を元にインタータイプ定義を作成し、コンポーネント定義に追加します。
InitMethodアノテーション
InitMethodアノテーションは、フィールド名がINIT_METHODでString型のフィールドです。
InitMethodアノテーションであるフィールドには、コンポーネントが初期化されるときに呼び出したいメソッド名を指定します。メソッドが複数ある時はカンマで区切ることが出来ます。
指定されたメソッド名から初期化メソッドを生成し、コンポーネント定義に追加します。
DestroyMethodアノテーション
DestroyMethodアノテーションは、フィールド名がDESTROY_METHODでString型のフィールドです。
DestroyMethodアノテーションであるフィールドには、コンポーネントが終了される時に呼び出したいメソッド名を指定します。メソッドが複数ある時はカンマで区切ることが出来ます。
指定されたメソッド名からdestroyメソッドを生成し、コンポーネント定義に追加します。
ASPECT, AUTO_BINDING, BINDING_SUFFIX, BINDING_TYPE, COMPONENT, DESTROY_METHOD, EXTERNAL_BINDING, INIT_METHOD, INSTANCE, INTER_TYPE, INTERCEPTOR, NAME, POINTCUT, VALUE| コンストラクタと説明 |
|---|
ConstantAnnotationHandler() |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
void |
appendAspect(ComponentDef componentDef) |
protected void |
appendAspect(ComponentDef componentDef,
String interceptor,
Method targetMethod)
指定されたインターセプタ名とメソッドからアスペクト定義を生成し、コンポーネント定義に追加します。
|
protected void |
appendAspect(ComponentDef componentDef,
String interceptor,
String pointcut)
指定されたインターセプタ名とポイントカットを表す文字列からアスペクト定義を生成し、コンポーネント定義に追加します。
|
void |
appendDestroyMethod(ComponentDef componentDef) |
protected void |
appendDestroyMethod(ComponentDef componentDef,
Method targetMethod)
指定されたメソッドからdestroyメソッド定義を生成し、コンポーネント定義に追加します。
|
protected void |
appendDestroyMethod(ComponentDef componentDef,
String methodName)
指定されたメソッド名からdestroyメソッド定義を生成し、コンポーネント定義に追加します。
|
void |
appendInitMethod(ComponentDef componentDef) |
protected void |
appendInitMethod(ComponentDef componentDef,
Method method)
指定されたメソッドから初期化メソッド定義を生成し、コンポーネント定義に追加します。
|
protected void |
appendInitMethod(ComponentDef componentDef,
String methodName)
指定されたメソッド名から初期化メソッド定義を生成し、コンポーネント定義に追加します。
|
void |
appendInterType(ComponentDef componentDef) |
protected void |
appendInterType(ComponentDef componentDef,
String interTypeName)
インタータイプ定義を生成し、その定義にインタータイプ名で生成したOGNL式をセットしてコンポーネント定義に追加します。
|
ComponentDef |
createComponentDef(Class<?> componentClass,
InstanceDef defaultInstanceDef,
AutoBindingDef defaultAutoBindingDef,
boolean defaultExternalBinding) |
PropertyDef |
createPropertyDef(BeanDesc beanDesc,
Field field) |
PropertyDef |
createPropertyDef(BeanDesc beanDesc,
PropertyDesc propertyDesc) |
protected boolean |
isConstantAnnotationField(Field field)
フィールドが定数アノテーションであるかどうかを判断します。
|
appendDI, createComponentDef, createComponentDef, createComponentDef, createComponentDef, createComponentDef, createComponentDef, createPropertyDef, getAutoBindingDef, getInstanceDef, getInstanceDef, isDestroyMethodRegisterable, isFieldInjectionTarget, isInitMethodRegisterablepublic ComponentDef createComponentDef(Class<?> componentClass, InstanceDef defaultInstanceDef, AutoBindingDef defaultAutoBindingDef, boolean defaultExternalBinding)
protected boolean isConstantAnnotationField(Field field)
field - フィールドtrue,そうでない場合はfalsepublic PropertyDef createPropertyDef(BeanDesc beanDesc, PropertyDesc propertyDesc)
public PropertyDef createPropertyDef(BeanDesc beanDesc, Field field)
public void appendAspect(ComponentDef componentDef)
protected void appendAspect(ComponentDef componentDef, String interceptor, String pointcut)
nullの場合にはEmptyRuntimeExceptionがスローされます。componentDef - コンポーネント定義interceptor - インターセプタ名pointcut - ポイントカットを表す文字列EmptyRuntimeException - インターセプタ名がnullの場合protected void appendAspect(ComponentDef componentDef, String interceptor, Method targetMethod)
nullの場合にはEmptyRuntimeExceptionがスローされます。componentDef - コンポーネント定義interceptor - インターセプタ名targetMethod - メソッドEmptyRuntimeException - インターセプタ名がnullの場合public void appendInterType(ComponentDef componentDef)
protected void appendInterType(ComponentDef componentDef, String interTypeName)
componentDef - コンポーネント定義interTypeName - インタータイプ名public void appendInitMethod(ComponentDef componentDef)
protected void appendInitMethod(ComponentDef componentDef, Method method)
componentDef - コンポーネント定義method - メソッドprotected void appendInitMethod(ComponentDef componentDef, String methodName)
componentDef - コンポーネント定義methodName - メソッド名public void appendDestroyMethod(ComponentDef componentDef)
protected void appendDestroyMethod(ComponentDef componentDef, Method targetMethod)
componentDef - コンポーネント定義targetMethod - メソッドprotected void appendDestroyMethod(ComponentDef componentDef, String methodName)
componentDef - コンポーネント定義methodName - メソッド名Copyright © 2015 The DBFlute Project. All rights reserved.