2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.yangtools.yang.binding;
\r
10 import java.util.ArrayList;
\r
11 import java.util.Collections;
\r
12 import java.util.List;
\r
15 * Uniquely identifies instance of data tree.
\r
19 public class InstanceIdentifier {
\r
22 private final List<PathArgument> path;
\r
23 private final Class<? extends DataObject> targetType;
\r
25 public InstanceIdentifier(Class<? extends DataObject> type) {
\r
26 path = Collections.emptyList();
\r
27 this.targetType = type;
\r
31 public InstanceIdentifier(List<PathArgument> path,Class<? extends DataObject> type) {
\r
32 this.path = Collections.<PathArgument>unmodifiableList(new ArrayList<>(path));
\r
33 this.targetType = type;
\r
41 public List<PathArgument> getPath() {
\r
45 public Class<?> getTargetType() {
\r
46 return this.targetType;
\r
51 * Path argument of instance identifier.
\r
53 * Interface which implementations are used as path components
\r
54 * of the instance path.
\r
59 public static interface PathArgument {
\r
63 public static class IdentifiableItem<I extends Identifiable<T>,T extends Identifier<I>> implements PathArgument {
\r
65 private final T key;
\r
66 private final Class<? extends I> type;
\r
68 public IdentifiableItem(Class<I> type, T key) {
\r
77 Class<? extends I> getType() {
\r