Package org.elegant.aash.comparator.parsing.visitor

Examples of org.elegant.aash.comparator.parsing.visitor.PropertyExpressionVisitor


  @Test
  public void testVisitSimpleDottedExpression() throws IOException {
    String sText = "bytes";
    DottedExpression expr = ExpressionParser.parse(sText);
    PropertyExpressionVisitor visitor = PropertyExpressionVisitor.of("titi", "toto");
    expr.accept(visitor);
    assertThat(visitor.getGraph().isChanged(), CoreMatchers.equalTo(true));
    visitor = PropertyExpressionVisitor.of("titi", "titi");
    expr.accept(visitor);
    assertThat(visitor.getGraph().isChanged(), CoreMatchers.equalTo(false));
  }
View Full Code Here


    DottedExpression expr = ExpressionParser.parse(sText);
    Model m1 = new Model("titi");
    m1.setDerived(new Model("titi"));
    Model m2 = new Model("titi");
    m2.setDerived(new Model("titi"));
    PropertyExpressionVisitor visitor = PropertyExpressionVisitor.of(m1, m2);
    expr.accept(visitor);
    assertThat(visitor.getGraph().isChanged(), CoreMatchers.equalTo(false));
    m2.setDerived(new Model("toto"));
    visitor = PropertyExpressionVisitor.of(m1, m2);
    expr.accept(visitor);
    assertThat(visitor.getGraph().isChanged(), CoreMatchers.equalTo(true));
  }
View Full Code Here

  public void testVisitArrayIntegerExpression() throws IOException {
    String sText = "children[0].name";
    DottedExpression expr = ExpressionParser.parse(sText);
    Model m1 = new Model("titi");
    Model m2 = new Model("titi");
    PropertyExpressionVisitor visitor = PropertyExpressionVisitor.of(m1, m2);
    expr.accept(visitor);
    assertThat(visitor.getGraph().isChanged(), CoreMatchers.equalTo(false));
    m1.setChildren(Lists.newArrayList(new Model("tutu")));
    visitor = PropertyExpressionVisitor.of(m1, m2);
    expr.accept(visitor);
    assertThat(visitor.getGraph().isChanged(), CoreMatchers.equalTo(true));
  }
View Full Code Here

    String sText = "children[*].name";
    DottedExpression expr = ExpressionParser.parse(sText);
    Model m1 = new Model("titi");
    m1.setChildren(Lists.newArrayList(new Model("tutu")));
    Model m2 = CompareTools.deepCopy(m1);
    PropertyExpressionVisitor visitor = PropertyExpressionVisitor.of(m1, m2);
    expr.accept(visitor);
    assertThat(visitor.getGraph().isChanged(), CoreMatchers.equalTo(false));
    m2.getChildren().get(0).setName("toto");
    visitor = PropertyExpressionVisitor.of(m1, m2);
    expr.accept(visitor);
    assertThat(visitor.getGraph().isChanged(), CoreMatchers.equalTo(true));
    m2.getChildren().get(0).setName("tutu");
    visitor = PropertyExpressionVisitor.of(m1, m2);
    expr.accept(visitor);
    assertThat(visitor.getGraph().isChanged(), CoreMatchers.equalTo(false));
    m2.getChildren().add(new Model("toto"));
    visitor = PropertyExpressionVisitor.of(m1, m2);
    expr.accept(visitor);
    assertThat(visitor.getGraph().isChanged(), CoreMatchers.equalTo(true));
  }
View Full Code Here

  public String getDescription() {
    return description;
  }

  boolean inspectChanges(T oldBean, T newBean) {
    PropertyExpressionVisitor visitor = PropertyExpressionVisitor.of(oldBean, newBean);
    expr.accept(visitor);
    return visitor.getGraph().isChanged(forgetOldNull, forgetNewNull);
  }
View Full Code Here

TOP

Related Classes of org.elegant.aash.comparator.parsing.visitor.PropertyExpressionVisitor

Copyright © 2018 www.massapicom. 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.