Java tutorial
//package com.java2s; import java.lang.reflect.Field; public class Main { public static String getId(Object t) { try { Field idField = t.getClass().getDeclaredField("id"); idField.setAccessible(true); return idField.get(t).toString(); } catch (Exception e) { e.printStackTrace(); } return null; } }