Package de.danielbechler.diff.selector

Examples of de.danielbechler.diff.selector.ElementSelector


  @Test
  public void return_proper_path_element()
  {
    final CollectionItemElementSelector expectedPathElement = new CollectionItemElementSelector(referenceItem);

    final ElementSelector actualPathElementSelector = accessor.getElementSelector();

    assertThat(actualPathElementSelector).isEqualTo(expectedPathElement);
  }
View Full Code Here


  @Override
  public String toString()
  {
    final StringBuilder sb = new StringBuilder();
    final Iterator<ElementSelector> iterator = elementSelectors.iterator();
    ElementSelector previousElementSelector = null;
    while (iterator.hasNext())
    {
      final ElementSelector elementSelector = iterator.next();
      if (elementSelector instanceof RootElementSelector)
      {
        sb.append("/");
      }
      else if (elementSelector instanceof CollectionItemElementSelector || elementSelector instanceof MapKeyElementSelector)
View Full Code Here

   * @return The requested child node or <code>null</code>.
   */
  public DiffNode getChild(final List<ElementSelector> selectors)
  {
    Assert.notEmpty(selectors, "selectors");
    final ElementSelector selector = selectors.get(0);
    if (selectors.size() == 1)
    {
      if (selector == RootElementSelector.getInstance())
      {
        return isRootNode() ? this : null;
View Full Code Here

    {
      throw new IllegalArgumentException("Detected attempt to add child node that is already the " +
          "child of another node. Adding nodes multiple times is not allowed, since it could " +
          "cause infinite loops.");
    }
    final ElementSelector pathElementSelector = node.getElementSelector();
    if (node.getParentNode() == null)
    {
      node.setParentNode(this);
      children.put(pathElementSelector, node);
    }
View Full Code Here

  {
    if (elementSelectors.isEmpty())
    {
      return;
    }
    final ElementSelector elementSelector = elementSelectors.get(0);
    NodePathValueHolder<T> nodePathValueHolder = valueHolderForElementSelector(elementSelector);
    if (nodePathValueHolder == null)
    {
      nodePathValueHolder = new NodePathValueHolder<T>();
      elementValueHolders.put(elementSelector, nodePathValueHolder);
View Full Code Here

    {
      accumulator.add(value);
    }
    if (elementIterator.hasNext())
    {
      final ElementSelector selector = elementIterator.next();
      final NodePathValueHolder<T> valueHolder = valueHolderForElementSelector(selector);
      if (valueHolder != null)
      {
        return valueHolder.visit(accumulator, elementIterator);
      }
View Full Code Here

      collector.it(nodePath, value);
    }
    for (final Map.Entry<ElementSelector, NodePathValueHolder<T>> entry : elementValueHolders.entrySet())
    {
      final NodePath childNodePath;
      final ElementSelector elementSelector = entry.getKey();
      final NodePathValueHolder<T> valueHolder = entry.getValue();
      if (elementSelector == RootElementSelector.getInstance())
      {
        childNodePath = NodePath.withRoot();
      }
View Full Code Here

  {
    final NodePath nodePath;
    if (parentNode != null)
    {
      final NodePath parentPath = parentNode.getPath();
      final ElementSelector elementSelector = instances.getSourceAccessor().getElementSelector();
      nodePath = NodePath.startBuildingFrom(parentPath).element(elementSelector).build();
    }
    else
    {
      nodePath = NodePath.withRoot();
View Full Code Here

  {
    final NodePath nodePath;
    if (parentNode != null)
    {
      final NodePath parentPath = parentNode.getPath();
      final ElementSelector elementSelector = instances.getSourceAccessor().getElementSelector();
      nodePath = NodePath.startBuildingFrom(parentPath).element(elementSelector).build();
    }
    else
    {
      nodePath = NodePath.withRoot();
View Full Code Here

TOP

Related Classes of de.danielbechler.diff.selector.ElementSelector

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.