org.omnaest.utils.beans.replicator
Interface PreservationAndIgnorationDeclarer

All Superinterfaces:
Serializable
All Known Subinterfaces:
BeanReplicator.DeclarationSupport

public interface PreservationAndIgnorationDeclarer
extends Serializable

A PreservationAndIgnorationDeclarer allows to specify excluded types and pathes, as well as preserved types and paths.
Additionally deepness levels can be specified to alter the traversal based on the deepness of instances.

Preservation in this context means that an source instance is kept as it is and being injected as it is into the target instance.
Ignoring means to exclude an instance from being injected into the target at all.

Author:
Omnaest

Method Summary
 void addAllIgnoredTypes(Iterable<? extends Class<?>> typeIterable)
          Similar to addIgnoredType(Class)
 void addAllPreservedTypes(Iterable<? extends Class<?>> typeIterable)
          Similar to addPreservedType(Class)
 void addIgnoredPath(String path)
          Adds a path to be ignored by the traversal when encountered.
 void addIgnoredType(Class<?> type)
          Adds a type to be ignored by the traversal at all.
 void addPreservedPath(String path)
          Adds a path for which the source instance will be injected into the target itself and no clone of it
 void addPreservedType(Class<?> type)
          Adds types of instances where no clone is made and which are injected directly into the target
 void setIgnoredDeepnessLevel(int deepnessLevel)
          Sets the deepness level, beginning from the traversal stops and no instances are set to the target instance

Levels are related to the number of tokens of the path.
 void setPreservedDeepnessLevel(int deepnessLevel)
          Sets the deepness level, beginning from all instances are preserved as they are and no clone operation is executed on them

Levels are related to the number of tokens of the path.
 

Method Detail

addAllPreservedTypes

void addAllPreservedTypes(Iterable<? extends Class<?>> typeIterable)
Similar to addPreservedType(Class)

Parameters:
typeIterable -
See Also:
addPreservedType(Class)

addPreservedType

void addPreservedType(Class<?> type)
Adds types of instances where no clone is made and which are injected directly into the target

Parameters:
type -
See Also:
addIgnoredType(Class), addPreservedPath(String), addAllPreservedTypes(Iterable)

addPreservedPath

void addPreservedPath(String path)
Adds a path for which the source instance will be injected into the target itself and no clone of it

Parameters:
path -
See Also:
addPreservedType(Class), addIgnoredPath(String)

setPreservedDeepnessLevel

void setPreservedDeepnessLevel(int deepnessLevel)
Sets the deepness level, beginning from all instances are preserved as they are and no clone operation is executed on them

Levels are related to the number of tokens of the path. A level of 1 e.g. is related to the direct properties of the root instance.
Setting the level to 1 would only create a clone of the root instance but preserve all instances of its properties without cloning them.

Parameters:
deepnessLevel -
See Also:
addPreservedType(Class), addPreservedPath(String), setIgnoredDeepnessLevel(int)

setIgnoredDeepnessLevel

void setIgnoredDeepnessLevel(int deepnessLevel)
Sets the deepness level, beginning from the traversal stops and no instances are set to the target instance

Levels are related to the number of tokens of the path. A level of 1 e.g. is related to the direct properties of the root instance.
Setting the level to 1 would only allow to create the root instance but ignoring all its properties.

Parameters:
deepnessLevel -
See Also:
addIgnoredType(Class), setPreservedDeepnessLevel(int)

addAllIgnoredTypes

void addAllIgnoredTypes(Iterable<? extends Class<?>> typeIterable)
Similar to addIgnoredType(Class)

Parameters:
typeIterable -

addIgnoredType

void addIgnoredType(Class<?> type)
Adds a type to be ignored by the traversal at all. This means that any source type encountered with the given type is not copied and not injected at all. This represents an exclusion mechanism.

Parameters:
type -
See Also:
addPreservedType(Class), addAllIgnoredTypes(Iterable)

addIgnoredPath

void addIgnoredPath(String path)
Adds a path to be ignored by the traversal when encountered. This is an exclusion mechanism.

Parameters:
path -
See Also:
addPreservedPath(String)


Copyright © 2013. All Rights Reserved.