com.merkle.oss.magnolia.powernode.PowerNodeIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of magnolia-powernode Show documentation
Show all versions of magnolia-powernode Show documentation
compiles and bundles generated and base classes
package com.merkle.oss.magnolia.powernode;
import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
import javax.jcr.NodeIterator;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class PowerNodeIterator> extends NodeIteratorAdapter {
private final AbstractPowerNodeDecorator powerNodeDecorator;
PowerNodeIterator(
final AbstractPowerNodeDecorator powerNodeDecorator,
final NodeIterator iterator
) {
super(iterator);
this.powerNodeDecorator = powerNodeDecorator;
}
@Override
public N nextNode() throws NoSuchElementException {
return powerNodeDecorator.wrapNode(super.nextNode());
}
public Stream toStream() {
return StreamSupport.stream(Spliterators.spliteratorUnknownSize((Iterator)this, Spliterator.ORDERED), false);
}
}