|
From: Geoffrey (JIRA) <no...@at...> - 2005-09-26 14:25:40
|
Binding to a superclass should be possible
------------------------------------------
Key: RCP-202
URL: http://opensource.atlassian.com/projects/spring/browse/RCP-202
Project: Spring Framework Rich Client Project
Type: Bug
Components: Binding System
Reporter: Geoffrey
Assigned to: Oliver Hutchison
The follow code should called for a conversion from Dog to Animal:
// Dog extends Animal
public class TextToAnimal extends AbstractConverter {
public TextToAnimal () {
}
public Class[] getSourceClasses() {
return new Class[]{String.class}; // subclasses count here
}
public Class[] getTargetClasses() {
return new Class[]{Animal.class}; // subclasses don't count (while they should)
}
protected Object doConvert(Object source, Class targetClass) throws Exception {
// ...
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
|
|
From: Geoffrey (JIRA) <no...@at...> - 2005-09-26 14:30:09
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-202?page=comments#action_14771 ] Geoffrey commented on RCP-202: ------------------------------ A similar bug: the source is an instanceof the targetClass, then no conversion should be done. For example I got this error: No converter registered to convert from sourceClass 'class ....OrderParticipantState' to target class 'class java.lang.Enum' (but if you try myOrderParticipantsState instanceof Enum it says true: emumOrderParticipantState is a subclass of Enum because all enums are). > Binding to a superclass should be possible > ------------------------------------------ > > Key: RCP-202 > URL: http://opensource.atlassian.com/projects/spring/browse/RCP-202 > Project: Spring Framework Rich Client Project > Type: Bug > Components: Binding System > Reporter: Geoffrey > Assignee: Oliver Hutchison > > The follow code should called for a conversion from Dog to Animal: > // Dog extends Animal > public class TextToAnimal extends AbstractConverter { > public TextToAnimal () { > } > public Class[] getSourceClasses() { > return new Class[]{String.class}; // subclasses count here > } > public Class[] getTargetClasses() { > return new Class[]{Animal.class}; // subclasses don't count (while they should) > } > protected Object doConvert(Object source, Class targetClass) throws Exception { > // ... > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
From: Oliver H. (JIRA) <no...@at...> - 2005-09-28 23:17:06
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-202?page=all ] Oliver Hutchison updated RCP-202: --------------------------------- Priority: Minor (was: Major) I don't see how this would work. If the converter worked for all subclasses, how would the conversion from String to a targetClass instance know which subclass is intended? > Binding to a superclass should be possible > ------------------------------------------ > > Key: RCP-202 > URL: http://opensource.atlassian.com/projects/spring/browse/RCP-202 > Project: Spring Framework Rich Client Project > Type: Bug > Components: Binding System > Reporter: Geoffrey > Assignee: Oliver Hutchison > Priority: Minor > > The follow code should called for a conversion from Dog to Animal: > // Dog extends Animal > public class TextToAnimal extends AbstractConverter { > public TextToAnimal () { > } > public Class[] getSourceClasses() { > return new Class[]{String.class}; // subclasses count here > } > public Class[] getTargetClasses() { > return new Class[]{Animal.class}; // subclasses don't count (while they should) > } > protected Object doConvert(Object source, Class targetClass) throws Exception { > // ... > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
From: Geoffrey (JIRA) <no...@at...> - 2005-09-30 06:46:06
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-202?page=comments#action_14839 ] Geoffrey commented on RCP-202: ------------------------------ By use of a factory method. In my particilar use case I need it for enums, which can be created with the following factory method in 1.5: Enum.valueOf(targetClass, (String) source) Of course by default subclass binders should take prescendence over superclass binders. To stipulate the difference between the targetClass matching and targetClass instantation, I 'd even recommend a namechange, something like: protected Object doConvert(Object source, Class instanceTargetClass) throws Exception { // ... } > Binding to a superclass should be possible > ------------------------------------------ > > Key: RCP-202 > URL: http://opensource.atlassian.com/projects/spring/browse/RCP-202 > Project: Spring Framework Rich Client Project > Type: Bug > Components: Binding System > Reporter: Geoffrey > Assignee: Oliver Hutchison > Priority: Minor > > The follow code should called for a conversion from Dog to Animal: > // Dog extends Animal > public class TextToAnimal extends AbstractConverter { > public TextToAnimal () { > } > public Class[] getSourceClasses() { > return new Class[]{String.class}; // subclasses count here > } > public Class[] getTargetClasses() { > return new Class[]{Animal.class}; // subclasses don't count (while they should) > } > protected Object doConvert(Object source, Class targetClass) throws Exception { > // ... > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
[Springframework-rcp-dev] [Spring-JIRA] Closed: (RCP-202) Binding
to a superclass should be possible
From: Jan H. (JIRA) <no...@sp...> - 2008-03-11 15:50:10
|
[ http://jira.springframework.org/browse/RCP-202?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jan Hoskens closed RCP-202.
---------------------------
Assignee: Jan Hoskens (was: Oliver Hutchison)
Resolution: Won't Fix
Fix Version/s: 1.0.0
The convertor is actually a part of the spring-binding library not of Spring Richclient. If the issue is still surfacing while using the latest version of that library, create an issue in the jira of spring-webflow which contains the spring-binding lib.
> Binding to a superclass should be possible
> ------------------------------------------
>
> Key: RCP-202
> URL: http://jira.springframework.org/browse/RCP-202
> Project: Spring Framework Rich Client Project
> Issue Type: Bug
> Components: Binding System
> Reporter: Geoffrey De Smet
> Assignee: Jan Hoskens
> Priority: Minor
> Fix For: 1.0.0
>
>
> The follow code should called for a conversion from Dog to Animal:
> // Dog extends Animal
> public class TextToAnimal extends AbstractConverter {
> public TextToAnimal () {
> }
> public Class[] getSourceClasses() {
> return new Class[]{String.class}; // subclasses count here
> }
> public Class[] getTargetClasses() {
> return new Class[]{Animal.class}; // subclasses don't count (while they should)
> }
> protected Object doConvert(Object source, Class targetClass) throws Exception {
> // ...
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springframework.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|