Class TubeCloner
- java.lang.Object
-
- com.sun.xml.ws.api.pipe.TubeCloner
-
- Direct Known Subclasses:
PipeCloner
public abstract class TubeCloner extends Object
Clones the whole pipeline.Since
Tube
s may form an arbitrary directed graph, someone needs to keep track of isomorphism for a clone to happen correctly. This class serves that role.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description Map<Object,Object>
master2copy
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
add(Tube original, Tube copy)
This method must be called from within the copy constructor to notify that the copy was created.static Tube
clone(Tube p)
Invoked by a client of a tube to clone the whole pipeline.abstract <T extends Tube>
Tcopy(T t)
Invoked by aTube.copy(com.sun.xml.ws.api.pipe.TubeCloner)
implementation to copy a reference to another pipe.
-
-
-
Method Detail
-
clone
public static Tube clone(Tube p)
Invoked by a client of a tube to clone the whole pipeline.Tube
s implementing theTube.copy(com.sun.xml.ws.api.pipe.TubeCloner)
method shall usecopy(Tube)
method.- Parameters:
p
- The entry point of a pipeline to be copied. must not be null.- Returns:
- The cloned pipeline. Always non-null.
-
copy
public abstract <T extends Tube> T copy(T t)
Invoked by aTube.copy(com.sun.xml.ws.api.pipe.TubeCloner)
implementation to copy a reference to another pipe.This method is for
Tube
implementations, not for users.If the given tube is already copied for this cloning episode, this method simply returns that reference. Otherwise it copies a tube, make a note, and returns a copied tube. This additional step ensures that a graph is cloned isomorphically correctly.
(Think about what happens when a graph is A->B, A->C, B->D, and C->D if you don't have this step.)
- Parameters:
t
- The tube to be copied.- Returns:
- The cloned tube. Always non-null.
-
add
public abstract void add(Tube original, Tube copy)
This method must be called from within the copy constructor to notify that the copy was created.When your pipe has references to other pipes, it's particularly important to call this method before you start copying the pipes you refer to, or else there's a chance of inifinite loop.
-
-