createMethod = method;
lifecycleMethods.add(method);
}
if ( method.isAnnotationPresent(In.class) )
{
In in = method.getAnnotation(In.class);
String name = toName( in.value(), method );
inAttributes.add( new BijectedMethod(name, method, in) );
}
if ( method.isAnnotationPresent(Out.class) )
{
Out out = method.getAnnotation(Out.class);
String name = toName( out.value(), method );
outAttributes.add( new BijectedMethod(name, method, out) );
}
if ( method.isAnnotationPresent(Unwrap.class) )
{
if (unwrapMethod!=null)
{
throw new IllegalStateException("component has two @Unwrap methods: " + name);
}
unwrapMethod = method;
}
if ( method.isAnnotationPresent(DataModel.class) ) //TODO: generalize
{
checkDataModelScope( method.getAnnotation(DataModel.class) );
}
if ( method.isAnnotationPresent(org.jboss.seam.annotations.Factory.class) )
{
Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); //can't use Init.instance() here 'cos of unit tests
String contextVariable = toName( method.getAnnotation(org.jboss.seam.annotations.Factory.class).value(), method );
init.addFactoryMethod(contextVariable, method, this);
if ( method.getAnnotation(org.jboss.seam.annotations.Factory.class).autoCreate() )
{
init.addAutocreateVariable(contextVariable);
}
}
if ( method.isAnnotationPresent(Observer.class) )
{
Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); //can't use Init.instance() here 'cos of unit tests
Observer observer = method.getAnnotation(Observer.class);
for ( String eventType : observer.value() )
{
if ( eventType.length()==0 ) eventType = method.getName(); //TODO: new defaulting rule to map @Observer onFooEvent() -> event type "fooEvent"
init.addObserverMethod( eventType, method, this, observer.create() );
}
}
if ( method.isAnnotationPresent(RequestParameter.class) )
{
RequestParameter rp = method.getAnnotation(RequestParameter.class);
String name = toName( rp.value(), method );
parameterSetters.add( new BijectedMethod(name, method, rp) );
}
if ( method.isAnnotationPresent(PRE_PASSIVATE) )
{
prePassivateMethod = method;
lifecycleMethods.add(method);
}
if ( method.isAnnotationPresent(POST_ACTIVATE) )
{
postActivateMethod = method;
lifecycleMethods.add(method);
}
if ( method.isAnnotationPresent(POST_CONSTRUCT) )
{
postConstructMethod = method;
lifecycleMethods.add(method);
}
if ( method.isAnnotationPresent(PRE_DESTROY) )
{
preDestroyMethod = method;
lifecycleMethods.add(method);
}
if ( method.isAnnotationPresent(PERSISTENCE_CONTEXT) )
{
if ( !type.isSessionBean() && type!=MESSAGE_DRIVEN_BEAN )
{
throw new IllegalArgumentException("@PersistenceContext may only be used on session bean or message driven bean components: " + name);
}
pcAttributes.add( new BijectedMethod( toName(null, method), method, null ) );
}
if ( method.isAnnotationPresent(Begin.class) ||
method.isAnnotationPresent(End.class) ||
method.isAnnotationPresent(StartTask.class) ||
method.isAnnotationPresent(BeginTask.class) ||
method.isAnnotationPresent(EndTask.class) )
{
conversationManagementMethods.add(method);
}
for ( Annotation ann: method.getAnnotations() )
{
if ( ann.annotationType().isAnnotationPresent(DataBinderClass.class) )
{
String name = toName( createWrapper(ann).getVariableName(ann), method );
dataModelGetters.add( new BijectedMethod(name, method, ann) );
dataModelNames.add(name);
}
if ( ann.annotationType().isAnnotationPresent(DataSelectorClass.class) )
{
selectionSetters.put(method, ann);
}
}
if ( !method.isAccessible() )
{
method.setAccessible(true);
}
}
for ( Field field: clazz.getDeclaredFields() )
{
if ( !field.isAccessible() )
{
field.setAccessible(true);
}
if ( field.isAnnotationPresent(In.class) )
{
In in = field.getAnnotation(In.class);
String name = toName( in.value(), field );
inAttributes.add( new BijectedField(name, field, in) );
}
if ( field.isAnnotationPresent(Out.class) )
{
Out out = field.getAnnotation(Out.class);