How to create such universal method in Java?
<p>Consider the following piece of code:</p>

<pre><code>public class QM1 {
    public static class A {
        Integer a = 1;
    }
    public static class B {
        String a = "blabla";
    }
    public static class C {
        A a = new A();
    }
    public static void main(String[] args) {
        Integer aa = getA(new A());
        String ba = getA(new B());
        A ca = getA(new C());

        System.out.println(aa);
        System.out.println(ba);
        System.out.println(ca);
    }
}
</code></pre>

<p>It must output is something like:</p>

<pre><code>1
blabla
QM1$A@2e807f85
</code></pre>

<p>What are your variants of implementing <code>getA</code> method? It must be single implementation.</p>
