I ran into a big problem though with annotations and submissions,
pointed out to me by JR. The way it's currently setup is that
parameters, submission beans, files are added to the last
submission that was declared. This can either by through class-
level @Submission annotations, or by method-level
@SubmissionHandler annotations. When using property setter
annotations for the parameters, submission beans and files, using
the @SubmissionHandler annotation is probably much more
convenient. Sadly though it turns out that Java reflection isn't
able to provide you with methods of a class in a predictable
order. Hence, the order of the methods in Class.getDeclaredMethods
can be different from your class layout, and it can even change
from JDK to JDK. This totally invalidates the usefulness of
'adding to last declared submission' since you're never sure what
the 'last submission is'. When you work with one submission, you
can still declare it as a class level annotation, however when
using multiple submissions, there seems to be no way to easily use
annotations on property setters for the data structure of the
submissions.
I don't really know what the 'best' solution is. Without resorting
to hacks, I can only come up with the introduction of the
submission name for each parameter, submission bean and file
property setter. I don't like that much though. When resorting to
hacks, it should be possible to make RIFE actually inspect the
element class bytecode and find all the methods names in the order
that they were compiled. This can then be used to iterate over
them when processing the annotations. However, I'm not sure what
the contract is for the method order in bytecode. It might not
even be the same as the method order in source.
Any thoughts on this?
A trivial but effective solution might be to add a new annotation:
"Position". This would take an integer argument to indicate the
order of methods. The methods that have this annotation will be
processed before those that don't have it, and according to the
numeric order that has been specified.
What do you guys think about this?
A small update ... I created an issue that explains this solution in
more detail:
http://uwyn.com/issues/browse/RIFE-286
--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users