Does EL support overloaded methods?

后端 未结 2 1273
再見小時候
再見小時候 2020-11-27 21:03

I upgraded my Java EE web application to use newer PrimeFaces version and suddenly the call of an overloaded bean method in an action attribute of PrimeFaces commandlink did

2条回答
  •  一个人的身影
    2020-11-27 21:18

    The way you can get around this is to create a generic method and do the 'routing' inside that method. I know that this might not be ideal, but you end up with less configurations in functions and XHTML pages.

    if (A.class.isInstance(obj)) {
        A o = (A) obj;
        return method(o, highRes);
    } else if (B.class.isInstance(obj)) {
        B o = (B) obj;
        return method(o, highRes);
    } else if (C.class.isInstance(obj)) {
        C o = (C) obj;
        return method(o, highRes);
    } else {
        throw new FacesException("Unsupported Conversion: " + obj);
    }
    

提交回复
热议问题