Package spoon.support.visitor.equals
Class CloneHelper
java.lang.Object
spoon.support.visitor.equals.CloneHelper
CloneHelper
is responsible for creating clones of CtElement
AST nodes including the whole subtree.
By default, the same instance of CloneHelper
is used for whole clonning process.
However, by subclassing this class and overriding method clone(CtElement)
,
one can extend and/or modify the cloning behavior.
For instance, one can listen to each call to clone and get each pair of `clone source` and `clone target`.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends CtElement>
voidaddClone(Collection<T> targetCollection, T element)
clones an element and adds it's clone as value into targetCollectionprotected <T extends CtElement>
voidclones a value and adds it's clone as value into targetMap under key<T extends CtElement>
Collection<T>clone(Collection<T> elements)
clones a Set of elements<T extends CtElement>
Tclone(T element)
void
Is called byCloneVisitor
at the end of the cloning for each element.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
CloneHelper
public CloneHelper()
-
-
Method Details
-
clone
-
clone
-
clone
-
clone
clones a Set of elements- Type Parameters:
T
- the Set of elements to be cloned- Returns:
- others Set of cloned elements
-
clone
-
addClone
clones an element and adds it's clone as value into targetCollection- Parameters:
targetCollection
- - the collection which will receive a clone of elementelement
- to be cloned element
-
addClone
clones a value and adds it's clone as value into targetMap under key- Parameters:
targetMap
- - the Map which will receive a clone of valuekey
- the target key, which has to be used to add cloned value into targetMapvalue
- to be cloned element
-
tailor
Is called byCloneVisitor
at the end of the cloning for each element.
-