You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "stephen mallette (JIRA)" <ji...@apache.org> on 2015/03/24 20:17:53 UTC
[jira] [Updated] (TINKERPOP3-512) Consider a CanClone interface to
help with instanceof-based cloning.
[ https://issues.apache.org/jira/browse/TINKERPOP3-512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
stephen mallette updated TINKERPOP3-512:
----------------------------------------
Component/s: process
> Consider a CanClone interface to help with instanceof-based cloning.
> --------------------------------------------------------------------
>
> Key: TINKERPOP3-512
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-512
> Project: TinkerPop 3
> Issue Type: Improvement
> Components: process
> Reporter: Marko A. Rodriguez
> Assignee: Marko A. Rodriguez
> Fix For: 3.0.0.GA
>
>
> {code:java}
> public interface CanClone<C> {
> public C cloneMe();
> }
> {code}
> {code:java}
> public final class MyObject implements Cloneable, CanClone<MyObject> {
> @Override
> public MyObject clone() throws CloneNotSupportedException {
> final MyObject clone = (MyObject) super.clone();
> // other stuff
> return clone;
> }
> @Override
> public MyObject<S, E> cloneMe() {
> try {
> return clone();
> } catch (final CloneNotSupportedException e) {
> throw new IllegalStateException(e.getMessage(), e);
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)