0

I have custom number converter like this:

@FacesConverter(value = "myConverter")
public class MyConverter implements Converter {

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        //get property type of back bean
        return null;
    }

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        // do something
        return null;
    }

}

If I could get the type of the backbean's field, I would not have to create a converter for each subclass of Number. Is there a way to achieve it?

xmcx
  • 283
  • 3
  • 18
  • JSF has build-in comverters for `Numbers` (and its subclasses afaik... ) But https://stackoverflow.com/questions/45758370/get-managed-bean-and-type-bound-to-value-attribute might help – Kukeltje Jan 20 '20 at 08:55
  • Yes, it is what I want. Thank you very much ! – xmcx Jan 20 '20 at 09:18

0 Answers0