vendredi 20 novembre 2015

How to call a singleton method?

I have a singleton object like:

Object o = new Object () {
  public void test() {
    //...
  }
};

But I cannot use o.test() because the class/interface does not have that method. Is there any way to achieve this using meta programming such as getMethods? Please do not suggest declaring an interface.





Aucun commentaire:

Enregistrer un commentaire