@Beta public class InstanceIdentifier<T extends TreeNode> extends Object implements org.opendaylight.yangtools.concepts.Path<InstanceIdentifier<? extends TreeNode>>, org.opendaylight.yangtools.concepts.Immutable, Serializable
module opendaylight-inventory { .... container nodes { list node { key "id"; ext:context-instance "node-context"; uses node; } } }You could create an instance identifier as follows to get to a node with id "openflow:1" InstanceIdentifierBuilder.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:1")).build(); This would be the same as using a path like so, "/nodes/node/openflow:1" to refer to the openflow:1 node
Modifier and Type | Field and Description |
---|---|
protected Iterable<TreeArgument> |
pathArguments |
Modifier and Type | Method and Description |
---|---|
protected com.google.common.base.MoreObjects.ToStringHelper |
addToStringAttributes(com.google.common.base.MoreObjects.ToStringHelper toStringHelper)
Add class-specific toString attributes.
|
<N extends TreeNode & Augmentation<? super T>> |
augmentation(Class<N> container) |
InstanceIdentifierBuilder<T> |
builder()
Create a builder rooted at this key.
|
static <N extends TreeChildNode<? extends TreeRoot,?>,K> |
builder(Class<N> listItem,
K listKey)
Create an InstanceIdentifierBuilder for a specific type of InstanceIdentifier which represents an IdentifiableItem
|
static <T extends TreeChildNode<? extends TreeRoot,?>> |
builder(Class<T> container)
Create an InstanceIdentifierBuilder for a specific type of InstanceIdentifier as specified by container
|
static <T extends TreeNode> |
builder(InstanceIdentifier<T> base)
Deprecated.
Use
builder() instead. |
<N extends TreeChildNode<? super T,?>> |
child(Class<N> container) |
<N extends TreeChildNode<? super T,?>,K> |
child(Class<N> listItem,
K listKey) |
boolean |
contains(InstanceIdentifier<? extends TreeNode> other)
Check whether an identifier is contained in this identifier.
|
boolean |
containsWildcarded(InstanceIdentifier<?> other)
Check whether this instance identifier contains the other identifier after wildcard expansion.
|
static <T extends TreeNode> |
create(Class<T> type)
Create an instance identifier for a very specific object type.
|
static InstanceIdentifier<?> |
create(Iterable<? extends TreeArgument> pathArguments)
Create an instance identifier for a very specific object type.
|
boolean |
equals(Object obj) |
protected boolean |
fastNonEqual(InstanceIdentifier<?> other)
Perform class-specific fast checks for non-equality.
|
<I extends TreeNode> |
firstIdentifierOf(Class<I> type)
Return an instance identifier trimmed at the first occurrence of a
specific component type.
|
<N extends TreeNode,K> |
firstKeyOf(Class<N> listItem)
Return the key associated with the first component of specified type in
an identifier.
|
<N extends TreeNode,K> |
firstKeyOf(Class<N> listItem,
Class<K> listKey)
Deprecated.
Use
firstKeyOf(Class) instead. |
List<TreeArgument> |
getPath()
Deprecated.
Use
getPathArguments() instead. |
Iterable<TreeArgument> |
getPathArguments()
Return the path argument chain which makes up this instance identifier.
|
Class<T> |
getTargetType()
Return the type of data which this InstanceIdentifier identifies.
|
int |
hashCode() |
boolean |
isWildcarded()
Check whether an instance identifier contains any wildcards.
|
static <N extends TreeNode,K> |
keyOf(InstanceIdentifier<N> id)
Return the key associated with the last component of the specified identifier.
|
String |
toString() |
protected final transient Iterable<TreeArgument> pathArguments
public final Class<T> getTargetType()
public final Iterable<TreeArgument> getPathArguments()
public final boolean isWildcarded()
protected boolean fastNonEqual(InstanceIdentifier<?> other)
other
- The other identifier, guaranteed to be the same classprotected com.google.common.base.MoreObjects.ToStringHelper addToStringAttributes(com.google.common.base.MoreObjects.ToStringHelper toStringHelper)
toStringHelper
- ToStringHelper instancepublic final <I extends TreeNode> InstanceIdentifier<I> firstIdentifierOf(Class<I> type)
identifier = InstanceIdentifierBuilder.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:1")).build();And you wanted to obtain the Instance identifier which represented Nodes you would do it like so,
identifier.firstIdentifierOf(Nodes.class)
type
- component type@Deprecated public final <N extends TreeNode,K> K firstKeyOf(Class<N> listItem, Class<K> listKey)
firstKeyOf(Class)
instead.listItem
- component typelistKey
- component key typepublic final <N extends TreeNode,K> K firstKeyOf(Class<N> listItem)
listItem
- component typepublic final boolean contains(InstanceIdentifier<? extends TreeNode> other)
contains
in interface org.opendaylight.yangtools.concepts.Path<InstanceIdentifier<? extends TreeNode>>
other
- public final boolean containsWildcarded(InstanceIdentifier<?> other)
contains(InstanceIdentifier)
, with the exception that a wildcards are assumed to match the their
non-wildcarded PathArgument counterpart.other
- Identifier which should be checked for inclusion.public InstanceIdentifierBuilder<T> builder()
public final <N extends TreeChildNode<? super T,?>> InstanceIdentifier<N> child(Class<N> container)
public final <N extends TreeChildNode<? super T,?>,K> KeyedInstanceIdentifier<N,K> child(Class<N> listItem, K listKey)
public final <N extends TreeNode & Augmentation<? super T>> InstanceIdentifier<N> augmentation(Class<N> container)
@Deprecated public final List<TreeArgument> getPath()
getPathArguments()
instead.@Deprecated public static <T extends TreeNode> InstanceIdentifierBuilder<T> builder(InstanceIdentifier<T> base)
builder()
instead.T
- base
- public static <T extends TreeChildNode<? extends TreeRoot,?>> InstanceIdentifierBuilder<T> builder(Class<T> container)
T
- container
- public static <N extends TreeChildNode<? extends TreeRoot,?>,K> InstanceIdentifierBuilder<N> builder(Class<N> listItem, K listKey)
N
- K
- listItem
- listKey
- public static InstanceIdentifier<?> create(Iterable<? extends TreeArgument> pathArguments)
List<PathArgument> path = Arrays.asList(new Item(Nodes.class)) new InstanceIdentifier(path);
pathArguments
- The path to a specific node in the data treeIllegalArgumentException
- if pathArguments is empty or
contains a null element.public static <T extends TreeNode> InstanceIdentifier<T> create(Class<T> type)
new InstanceIdentifier(Nodes.class)would create an InstanceIdentifier for an object of type Nodes
type
- The type of the object which this instance identifier representspublic static <N extends TreeNode,K> K keyOf(InstanceIdentifier<N> id)
id
- instance identifierIllegalArgumentException
- if the supplied identifier type cannot have a key.NullPointerException
- if id is null.Copyright © 2019 OpenDaylight. All rights reserved.