public GridElement cloneFromMe() { try { java.lang.Class<? extends GridElement> cx = this.getClass(); // get class of dynamic object GridElement c = cx.newInstance(); c.setPanelAttributes(getPanelAttributes()); // copy states c.setRectangle(getRectangle()); getDiagramHandler().setHandlerAndInitListeners(c); return c; } catch (Exception e) { log.error("Error at calling CloneFromMe() on entity", e); } return null; }