public void onCircularReferenceException(final DiffNode node) { final String message = "Detected circular reference in node at path {}. " + "Going deeper would cause an infinite loop, so I'll stop looking at " + "this instance along the current path."; logger.warn(message, node.getPath()); } };
@Override protected String differenceToString(final DiffNode node, final Object base, final Object modified) { final String text = super.differenceToString(node, base, modified); messages.put(node.getPath(), text); return text; }
private Collection<String> categoriesFromNodePathConfiguration(final DiffNode node) { final Collection<String> allCategories = new HashSet<String>(); final List<String[]> accumulatedValues = nodePathCategories.accumulatedValuesForNodePath(node.getPath()); for (final String[] categoriesForElement : accumulatedValues) { allCategories.addAll(asList(categoriesForElement)); } return allCategories; }
public boolean matches(final NodePath path) { return path.matches(getPath()); }
protected String differenceToString(final DiffNode node, final Object base, final Object modified) { final NodePath nodePath = node.getPath(); final String stateMessage = translateState(node.getState(), node.canonicalGet(base), node.canonicalGet(modified)); final String propertyMessage = String.format("Property at path '%s' %s", nodePath, stateMessage); final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(propertyMessage); if (node.isCircular()) { stringBuilder.append(" (Circular reference detected: The property has already been processed at another position.)"); } return stringBuilder.toString(); }
public Inclusion getInclusion(final DiffNode node) { if (isInactive()) { return DEFAULT; } return resolveInclusion(inclusions.getNodeForPath(node.getPath())); }
public Introspector introspectorForNode(final DiffNode node) { final Introspector typeIntrospector = typeIntrospectorMap.get(node.getValueType()); if (typeIntrospector != null) { return typeIntrospector; } final Introspector nodePathIntrospector = nodePathIntrospectorHolder.valueForNodePath(node.getPath()); if (nodePathIntrospector != null) { return nodePathIntrospector; } if (defaultIntrospector == null) { defaultIntrospector = new StandardIntrospector(); } return defaultIntrospector; }
protected void print(final DiffNode node, final int level) { final String nodeAsString = node.getPath() + " ===> " + node.toString(); final String indentedNodeString = Strings.indent(level, nodeAsString); print(indentedNodeString); }
public boolean isIntrospectable(final DiffNode node) { final Class<?> nodeType = node.getValueType(); if (nodeType == null) { return false; } else if (isPrimitiveTypeEnumOrArray(nodeType)) { return false; } else if (nodePathIntrospectionModeHolder.valueForNodePath(node.getPath()) == IntrospectionMode.DISABLED) { return false; } else if (typeIntrospectionModeMap.get(nodeType) == IntrospectionMode.DISABLED) { return false; } return true; }
public IdentityStrategy resolveIdentityStrategy(final DiffNode node) { IdentityStrategy identityStrategy = typePropertyIdentityStrategyResolver.resolve(node); if (identityStrategy != null) { return identityStrategy; } identityStrategy = nodePathIdentityStrategies.getNodeForPath(node.getPath()).getValue(); if (identityStrategy != null) { return identityStrategy; } return defaultIdentityStrategy; }
public void node(final DiffNode node, final Visit visit) { final NodePath differencePath = node.getPath(); if (differencePath.matches(nodePath) || differencePath.isParentOf(nodePath)) { if (differencePath.matches(nodePath)) { this.node = node; visit.stop(); } } else { visit.dontGoDeeper(); } }
public ComparisonStrategy resolveComparisonStrategy(final DiffNode node) final ComparisonStrategy comparisonStrategy = nodePathComparisonStrategies.valueForNodePath(node.getPath()); if (comparisonStrategy != null)
private static NodePath getNodePath(final DiffNode parentNode, final Instances instances) { if (parentNode == null) { return NodePath.withRoot(); } else { final NodePath parentPath = parentNode.getPath(); final ElementSelector elementSelector = instances.getSourceAccessor().getElementSelector(); return NodePath.startBuildingFrom(parentPath).element(elementSelector).build(); } }
/** * @return The absolute property path from the object root up to this node. */ public NodePath getPath() { if (parentNode != null) { return NodePath.startBuildingFrom(parentNode.getPath()) .element(accessor.getElementSelector()) .build(); } else if (accessor instanceof RootAccessor) { return NodePath.withRoot(); } else { return NodePath.startBuilding().element(accessor.getElementSelector()).build(); } }
public void onCircularReferenceException(final DiffNode node) { final String message = "Detected circular reference in node at path {}. " + "Going deeper would cause an infinite loop, so I'll stop looking at " + "this instance along the current path."; logger.warn(message, node.getPath()); } };
@Override protected String differenceToString(final DiffNode node, final Object base, final Object modified) { final String text = super.differenceToString(node, base, modified); messages.put(node.getPath(), text); return text; }
private Collection<String> categoriesFromNodePathConfiguration(final DiffNode node) { final Collection<String> allCategories = new HashSet<String>(); final List<String[]> accumulatedValues = nodePathCategories.accumulatedValuesForNodePath(node.getPath()); for (final String[] categoriesForElement : accumulatedValues) { allCategories.addAll(asList(categoriesForElement)); } return allCategories; }
public Inclusion getInclusion(final DiffNode node) { if (isInactive()) { return DEFAULT; } return resolveInclusion(inclusions.getNodeForPath(node.getPath())); }
protected void print(final DiffNode node, final int level) { final String nodeAsString = node.getPath() + " ===> " + node.toString(); final String indentedNodeString = Strings.indent(level, nodeAsString); print(indentedNodeString); }
private static NodePath getNodePath(final DiffNode parentNode, final Instances instances) { if (parentNode == null) { return NodePath.withRoot(); } else { final NodePath parentPath = parentNode.getPath(); final ElementSelector elementSelector = instances.getSourceAccessor().getElementSelector(); return NodePath.startBuildingFrom(parentPath).element(elementSelector).build(); } }