/** * Returns a clone of this table. This method clones the {@linkplain #getRoot() root} node. * If the root is an instance of {@link Node}, then cloning the root will recursively clone * all its {@linkplain Node#getChildren() children}. * * @return a clone of this table. * @throws CloneNotSupportedException if this table, the root node or one of its children * can not be cloned. * * @see Node#clone() */ @Override public DefaultTreeTable clone() throws CloneNotSupportedException { final DefaultTreeTable clone = (DefaultTreeTable) super.clone(); clone.root = (TreeTable.Node) Cloner.cloneIfPublic(clone.root); return clone; }
/** * Returns a clone of this table. This method clones the {@linkplain #getRoot() root} node. * If the root is an instance of {@link Node}, then cloning the root will recursively clone * all its {@linkplain Node#getChildren() children}. * * @return a clone of this table. * @throws CloneNotSupportedException if this table, the root node or one of its children * can not be cloned. * * @see Node#clone() */ @Override public DefaultTreeTable clone() throws CloneNotSupportedException { final DefaultTreeTable clone = (DefaultTreeTable) super.clone(); clone.root = (TreeTable.Node) Cloner.cloneIfPublic(clone.root); return clone; }
/** * If the value is cloneable, clones it before to return it. */ @Override public T getValue() { T value = super.getValue(); if (value instanceof Cloneable) try { value = getDescriptor().getValueClass().cast(Cloner.cloneIfPublic(value)); } catch (CloneNotSupportedException e) { throw new UnsupportedOperationException(Errors.format(Errors.Keys.CloneNotSupported_1, value.getClass()), e); } return value; }
/** * If the value is cloneable, clones it before to return it. */ @Override public T getValue() { T value = super.getValue(); if (value instanceof Cloneable) try { value = getDescriptor().getValueClass().cast(Cloner.cloneIfPublic(value)); } catch (CloneNotSupportedException e) { throw new UnsupportedOperationException(Errors.format(Errors.Keys.CloneNotSupported_1, value.getClass()), e); } return value; }