You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/05/14 22:51:58 UTC
svn commit: r774923 - /incubator/pivot/trunk/wtk/src/pivot/wtkx/Bindable.java
Author: gbrown
Date: Thu May 14 20:51:58 2009
New Revision: 774923
URL: http://svn.apache.org/viewvc?rev=774923&view=rev
Log:
Make two passes through fields when binding: one for load and a second for bind (annotations are not guaranteed to be processed in the order in which they are declared).
Modified:
incubator/pivot/trunk/wtk/src/pivot/wtkx/Bindable.java
Modified: incubator/pivot/trunk/wtk/src/pivot/wtkx/Bindable.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtkx/Bindable.java?rev=774923&r1=774922&r2=774923&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtkx/Bindable.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtkx/Bindable.java Thu May 14 20:51:58 2009
@@ -256,6 +256,7 @@
ArrayList<String> privateFieldNames = new ArrayList<String>();
+ // Process load annotations
for (int j = 0, n = fields.length; j < n; j++) {
Field field = fields[j];
String fieldName = field.getName();
@@ -336,13 +337,16 @@
}
}
+ }
+
+ // Process bind annotations
+ for (int j = 0, n = fields.length; j < n; j++) {
+ Field field = fields[j];
+ String fieldName = field.getName();
+ int fieldModifiers = field.getModifiers();
+
Bind bindAnnotation = field.getAnnotation(Bind.class);
if (bindAnnotation != null) {
- if (loadAnnotation != null) {
- throw new BindException("Cannot combine " + Load.class.getName()
- + " and " + Bind.class.getName() + " annotations.");
- }
-
// Ensure that we can write to the field
if ((fieldModifiers & Modifier.FINAL) > 0) {
throw new BindException(fieldName + " is final.");