Package de.danielbechler.diff.node

Examples of de.danielbechler.diff.node.DiffNode.visit()


    baseC.setReference(baseA);

    final ObjectDiffer objectDiffer = ObjectDifferBuilder.buildDefault();
//    objectDiffer.getConfiguration().withoutCircularNodes();
    final DiffNode root = objectDiffer.compare(workingA, baseA);
    root.visit(new PrintingVisitor(workingA, baseA));
    assertThat(root).child("reference", "reference", "reference").isCircular();
  }
}
View Full Code Here


    final String working = "Hello";
    final String base = "World";
    final DiffNode root = objectDiffer.compare(working, base);

    root.visit(new PrintingVisitor(working, base));
  }

  private static void phoneBookExample()
  {
    final PhoneBook phoneBook = new PhoneBook("Breaking Bad");
View Full Code Here

    modifiedPhoneBook.getContact("Walter", "White").setMiddleName("Hartwell");

    final ObjectDiffer objectDiffer = ObjectDifferBuilder.buildDefault();
    final DiffNode root = objectDiffer.compare(modifiedPhoneBook, phoneBook);
    final DiffNode.Visitor visitor = new PrintingVisitor(modifiedPhoneBook, phoneBook);
    root.visit(visitor);
  }
}
View Full Code Here

    final Person p1 = new Person(hat1);
    final Person p2 = new Person(hat2);

    final DiffNode root = objectDiffer.compare(p1, p2);

    root.visit(new DiffNode.Visitor()
    {
      public void node(final DiffNode node, final Visit visit)
      {
        System.out.print(node.getPath() + " :: ");
        System.out.print(node.canonicalGet(p1));
View Full Code Here

  @SuppressWarnings({"unchecked"})
  public <T> T merge(final T modified, final T base, final T head)
  {
    final DiffNode.Visitor visitor = new MergingDifferenceVisitor<T>(head, modified);
    final DiffNode difference = objectDiffer.compare(modified, base);
    difference.visit(visitor);
    return head;
  }

  private static final class MergingDifferenceVisitor<T> implements DiffNode.Visitor
  {
View Full Code Here

    base.setValue(1);

    ObjectDiffer differ = ObjectDifferBuilder.buildDefault();
    final DiffNode root = differ.compare(working, base);

    root.visit(new PrintingVisitor(working, base));
  }

  public static void testIntegerWorksPrivate()
  {
View Full Code Here

    final ObjectDifferBuilder builder = ObjectDifferBuilder.startBuilding();
    builder.inclusion().include().node(NodePath.with("aliases"));
    final ObjectDiffer differ = builder.build();

    final DiffNode root = differ.compare(b, a);
    root.visit(new PrintingVisitor(b, a));

    NodeAssertions.assertThat(root).root().hasChanges();
  }
}
View Full Code Here

    base.setValue(1);

    ObjectDiffer differ = ObjectDifferBuilder.buildDefault();
    final DiffNode root = differ.compare(working, base);

    root.visit(new PrintingVisitor(working, base));
  }

  public static void testIntegerWorksPublic()
  {
View Full Code Here

    base.setValue(1);

    ObjectDiffer differ = ObjectDifferBuilder.buildDefault();
    final DiffNode root = differ.compare(working, base);

    root.visit(new PrintingVisitor(working, base));
  }

  public static void main(final String[] args)
  {
View Full Code Here

  private static DiffNode compareAndPrint(final GraphNode modified, final GraphNode base)
  {
    final DiffNode root = ObjectDifferBuilder.buildDefault().compare(modified, base);
    if (PRINT_ENABLED)
    {
      root.visit(new PrintingVisitor(modified, base));
    }
    return root;
  }

  @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.