PDA

View Full Version : Custom editor conflicts with BeanWrapperImpl


dobes
Nov 28th, 2004, 07:51 PM
I have a case where I want to register a custom editor for a common superclass of my other custom editors; it allows a form to choose an object of one of that class's subclasses. Most of the time, however, I am binding to the subclass type directly.

When I register superclass custom editor, it overrides some of the subclasses and not others, depending on the hashtable order of the classes (last assignable class wins). I'm using the released spring 1.1.1.

Is there a clever way to upgrade the BeanWrapperImpl (without dumping a whole bunch of spring source into my project and directly editing it) to take an exact match on class if there is one?

And could this be (or is this) the default behavior in the next release(s) ?


binder.registerCustomEditor(Book.class, new EntityPropertyEditor(Book.class));
binder.registerCustomEditor(BaseBook.class, new EntityPropertyEditor(Book.class));
binder.registerCustomEditor(CharacterClass.class, new EntityPropertyEditor(CharacterClass.class));
binder.registerCustomEditor(CharacterRecord.class, new EntityPropertyEditor(CharacterRecord.class));
binder.registerCustomEditor(Domain.class, new EntityPropertyEditor(Domain.class));
binder.registerCustomEditor(Feat.class, new EntityPropertyEditor(Feat.class));
binder.registerCustomEditor(Item.class, new EntityPropertyEditor(Item.class));
binder.registerCustomEditor(Race.class, new EntityPropertyEditor(Race.class));
binder.registerCustomEditor(Skill.class, new EntityPropertyEditor(Skill.class));
binder.registerCustomEditor(Spell.class, new EntityPropertyEditor(Spell.class));
binder.registerCustomEditor(SpellList.class, new EntityPropertyEditor(SpellList.class));

// This is a superclass of all the above
binder.registerCustomEditor(NamedEntity.class, new EntityPropertyEditor(NamedEntity.class));