Package de.danielbechler.diff.inclusion
Interface InclusionResolver
public interface InclusionResolver
This can be used to implement custom inclusion mechanisms. Some objects may not be relevant or suitable for the
comparison process. Using an
InclusionResolver is a powerful and flexible
way to detect and exclude those objects.
Keep in mind that every single node in the object graph will be checked against each and every registered InclusionResolver. If performance is important to you, make sure that calling its
methods is as cheap as possible.-
Method Summary
Modifier and TypeMethodDescriptionbooleanWhen this method returnstrue, it causes the inclusion service to exclude all nodes that are not explicitly included viaInclusion.INCLUDED.getInclusion(DiffNode node) Determines whether a givenDiffNodeshould be included into the comparison process.
-
Method Details
-
getInclusion
Determines whether a givenDiffNodeshould be included into the comparison process.- Parameters:
node- The node to determine the inclusion for. Keep in mind that theDiffNodedoesn't contain any children at this point and albeit it is already linked to its parent node, the parent node also probably hasn't been fully processed yet. It is only safe to examine the node path and type related properties along the path up to the root node, but definitely not to make any decisions based on the state or number of child nodes.- Returns:
- Returns either
Inclusion.INCLUDEDto indicate an explicit inclusion,Inclusion.EXCLUDEDto inidicate an explicit exclusion orInclusion.DEFAULTin case this resolver doesn't want to influence the decision. This method should never returnnull.
-
enablesStrictIncludeMode
boolean enablesStrictIncludeMode()When this method returnstrue, it causes the inclusion service to exclude all nodes that are not explicitly included viaInclusion.INCLUDED. Otherwise nodes withInclusion.DEFAULTwill also be included.
-