*/
package org.opendaylight.yangtools.yang.data.tree.leafref;
+import com.google.common.collect.ImmutableList;
import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
public final class LeafRefUtils {
private LeafRefUtils() {
* @param module module
* @return LeafRefPath object
*/
- public static LeafRefPath createAbsoluteLeafRefPath(
- final LeafRefPath leafRefPath, final SchemaPath contextNodeSchemaPath,
- final Module module) {
+ public static LeafRefPath createAbsoluteLeafRefPath(final LeafRefPath leafRefPath,
+ final ImmutableList<QName> contextNodeSchemaPath, final Module module) {
if (leafRefPath.isAbsolute()) {
return leafRefPath;
}
return LeafRefPath.create(absoluteLeafRefTargetPathList, true);
}
- private static Deque<QNameWithPredicate> schemaPathToXPathQNames(final SchemaPath nodePath, final Module module) {
+ private static Deque<QNameWithPredicate> schemaPathToXPathQNames(final ImmutableList<QName> nodePath,
+ final Module module) {
final Deque<QNameWithPredicate> xpath = new LinkedList<>();
- final Iterator<QName> nodePathIterator = nodePath.getPathFromRoot().iterator();
+ final Iterator<QName> nodePathIterator = nodePath.iterator();
DataNodeContainer currenDataNodeContainer = module;
while (nodePathIterator.hasNext()) {
return xpath;
}
- public static LeafRefPath schemaPathToLeafRefPath(final SchemaPath nodePath, final Module module) {
+ public static LeafRefPath schemaPathToLeafRefPath(final ImmutableList<QName> nodePath, final Module module) {
return LeafRefPath.create(schemaPathToXPathQNames(nodePath, module), true);
}
}