Results 1 to 4 of 4
Thread: Binding Converter for an Array
- 08-18-2009, 06:45 AM #1
Binding Converter for an Array
Suppose I have a model like below:
Model{
int[] order = new int[] {1,2,3,4};
}
I want to bind this to a textfield`s text property. I have written a converter extending org.jdesktop.beansbinding.Converter<Integer[],String>.
But it is not working issuing a ClassCastException at the definition of the class.
- 08-24-2009, 11:48 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Note that an int[] cannot be implicitly or (explicitly) cast to an Integer[].
- 08-25-2009, 05:19 AM #3
Yes, I realized this later. When I used the converter as extending Converter<int[],String>, it worked. I was under the impression that while using generics I must use a class type rather than a primitive.
Thanks for your help
- 08-25-2009, 05:25 AM #4
int is a primative; whereas int[] is not. You pass the int[] as a reference.
My Hobby Project: LegacyClone
Similar Threads
-
Question about early binding
By Jary316 in forum New To JavaReplies: 5Last Post: 12-17-2008, 06:12 AM -
[SOLVED] Key binding Q
By playwin2 in forum New To JavaReplies: 3Last Post: 11-04-2008, 06:04 AM -
Spring binding in jsp
By Pierre Javason in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 05-05-2008, 12:21 PM -
Dynamic Binding
By javarishi in forum New To JavaReplies: 3Last Post: 04-09-2008, 11:17 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks