public Segment segment( String segment ) { return paths.createSegment(segment); }
private Path pathFor( PathFactory pathFactory, ClassMetadata cmd ) { List<Segment> segments = new LinkedList<Segment>(); for (String segment : cmd.getClassName().split("\\.")) { segments.add(pathFactory.createSegment(segment)); } return pathFactory.createRelativePath(segments); }
@Factory public static Matcher<Iterable<Segment>> hasSegment( PathFactory pathFactory, String element ) { Path.Segment segment = pathFactory.createSegment(element); return hasSegment(equalTo(segment)); }
Path.Segment segment = cache.pathFactory.createSegment(name, i + 1); sibling.updateLocation(segment);
if (childrenWithSameNames.size() == 1) { MapNode childWithSameName = childrenWithSameNames.get(0); Path.Segment newName = context.getValueFactories().getPathFactory().createSegment(name, Path.DEFAULT_INDEX); childWithSameName.setName(newName); return; Path.Segment segment = childWithSameName.getName(); if (segment.getIndex() != index) { Path.Segment newName = context.getValueFactories().getPathFactory().createSegment(name, index); childWithSameName.setName(newName);
if (sns != firstSegment.getIndex()) { Segment newSegment = pathFactory.createSegment(nodeName, sns); path = pathFactory.createRelativePath(newSegment); topLevelSegmentReplacements.put(firstSegment, path);
/** * Utility to create a {@link Path.Segment} from a string, where there will be no index * * @param name the string form of the path segment, which may include a 1-based same-name-sibling index * @return the path object * @throws ValueFormatException if a path could not be created from the supplied string */ protected Path.Segment segment( String name ) { return context.getValueFactories().getPathFactory().createSegment(name); }
protected Path.Segment segment( String segment ) { return context.getValueFactories().getPathFactory().createSegment(segment); }
private Segment segment( String name ) { return context.getValueFactories().getPathFactory().createSegment(name); }
protected Path.Segment segment( String segment ) { return context.getValueFactories().getPathFactory().createSegment(segment); }
public Segment segment( String segment ) { return context.getValueFactories().getPathFactory().createSegment(segment); }
public Segment segment( String segment ) { return context.getValueFactories().getPathFactory().createSegment(segment); }
protected Path.Segment segment( String segment ) { return context.getValueFactories().getPathFactory().createSegment(segment); }
public Segment segment( String segment ) { return context.getValueFactories().getPathFactory().createSegment(segment); }
protected void assertChildren( Node<Object, Object> node, String... childNames ) { assertThat(node.getChildrenCount(), is(childNames.length)); List<Path.Segment> segments = new LinkedList<Path.Segment>(); for (String childName : childNames) { segments.add(pathFactory.createSegment(childName)); } Iterator<Path.Segment> expectedIter = segments.iterator(); Iterator<Node<Object, Object>> actualIter = node.getChildren().iterator(); while (expectedIter.hasNext() && actualIter.hasNext()) { Node<Object, Object> actualNode = actualIter.next(); Path actualPath = actualNode.getPath(); Path.Segment actualSegment = actualPath.getLastSegment(); Path.Segment expectedSegment = expectedIter.next(); assertThat(actualSegment, is(expectedSegment)); } assertThat(expectedIter.hasNext(), is(false)); assertThat(actualIter.hasNext(), is(false)); }
Path.Segment newName = context.getValueFactories().getPathFactory().createSegment(name, nextIndex); node.setName(newName); node.setProperties(properties, null);
int sns = 1; for (Node<Payload, PropertyPayload> child : entry.getValue()) { Path.Segment childSegment = cache.pathFactory.createSegment(childName, sns++); child.updateLocation(childSegment);
child.parent = this; Path.Segment segment = cache.pathFactory.createSegment(childName, currentChildren.size()); child.updateLocation(segment);
if (sibling.getName().getName().equals(name)) { NodeType oldSibling = (NodeType)sibling.clone(); sibling = (NodeType)sibling.withName(pathFactory.createSegment(name, snsIndex++)); changes.changed(oldSibling, sibling);
NodeType sibling = iter.next(); if (sibling.getName().getName().equals(name)) { sibling = (NodeType)sibling.withName(pathFactory.createSegment(name, snsIndex++)); changes.changed(sibling);