本文整理了Java中org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create()
方法的一些代码示例,展示了YangInstanceIdentifier.create()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangInstanceIdentifier.create()
方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
类名称:YangInstanceIdentifier
方法名:create
暂无
代码示例来源:origin: opendaylight/yangtools
public static YangInstanceIdentifier create(final PathArgument... path) {
// We are forcing a copy, since we cannot trust the user
return create(Arrays.asList(path));
}
代码示例来源:origin: org.opendaylight.yangtools/yang-data-api
public static YangInstanceIdentifier create(final PathArgument... path) {
// We are forcing a copy, since we cannot trust the user
return create(Arrays.asList(path));
}
代码示例来源:origin: org.opendaylight.yangtools/yang-data-api
/**
* Returns a new InstanceIdentifier with only one path argument of type {@link NodeIdentifier} with supplied
* QName.
*
* @param name QName of first node identifier
* @return Instance Identifier with only one path argument of type {@link NodeIdentifier}
*/
public static YangInstanceIdentifier of(final QName name) {
return create(new NodeIdentifier(name));
}
代码示例来源:origin: opendaylight/yangtools
/**
* Returns a new InstanceIdentifier with only one path argument of type {@link NodeIdentifier} with supplied
* QName.
*
* @param name QName of first node identifier
* @return Instance Identifier with only one path argument of type {@link NodeIdentifier}
*/
public static YangInstanceIdentifier of(final QName name) {
return create(new NodeIdentifier(name));
}
代码示例来源:origin: opendaylight/yangtools
@Override
public YangInstanceIdentifier getParent() {
if (path.isEmpty()) {
return null;
}
YangInstanceIdentifier ret = parent;
if (ret == null) {
ret = YangInstanceIdentifier.create(path.subList(0, path.size() - 1));
parent = ret;
}
return ret;
}
代码示例来源:origin: org.opendaylight.yangtools/yang-data-api
@Override
public YangInstanceIdentifier getParent() {
if (path.isEmpty()) {
return null;
}
YangInstanceIdentifier ret = parent;
if (ret == null) {
ret = YangInstanceIdentifier.create(path.subList(0, path.size() - 1));
parent = ret;
}
return ret;
}
代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-dom-codec
@Override
public YangInstanceIdentifier serialize(final InstanceIdentifier<?> input) {
final List<PathArgument> domArgs = new ArrayList<>();
context.getCodecContextNode(input, domArgs);
return YangInstanceIdentifier.create(domArgs);
}
代码示例来源:origin: org.opendaylight.controller/sal-clustering-commons
private YangInstanceIdentifier readYangInstanceIdentifierInternal() throws IOException {
int size = input.readInt();
List<PathArgument> pathArguments = new ArrayList<>(size);
for(int i = 0; i < size; i++) {
pathArguments.add(readPathArgument());
}
return YangInstanceIdentifier.create(pathArguments);
}
代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding2-dom-codec
@Override
public YangInstanceIdentifier serialize(final InstanceIdentifier<?> input) {
final List<PathArgument> domArgs = new ArrayList<>();
context.getCodecContextNode(input, domArgs);
return YangInstanceIdentifier.create(domArgs);
}
代码示例来源:origin: opendaylight/controller
private YangInstanceIdentifier readYangInstanceIdentifierInternal() throws IOException {
int size = input.readInt();
final Builder<PathArgument> pathArguments = ImmutableList.builderWithExpectedSize(size);
for (int i = 0; i < size; i++) {
pathArguments.add(readPathArgument());
}
return YangInstanceIdentifier.create(pathArguments.build());
}
代码示例来源:origin: opendaylight/yangtools
@Nonnull
@Override
public YangInstanceIdentifier getAncestor(final int depth) {
checkArgument(depth >= 0, "Negative depth is not allowed");
checkArgument(depth <= path.size(), "Depth %s exceeds maximum depth %s", depth, path.size());
if (depth == path.size()) {
return this;
}
if (depth == path.size() - 1) {
// Use the parent cache
return getParent();
}
return YangInstanceIdentifier.create(path.subList(0, depth));
}
代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-dom-codec
public Entry<YangInstanceIdentifier, BindingStreamEventWriter> newWriter(final InstanceIdentifier<?> path,
final NormalizedNodeStreamWriter domWriter) {
final List<YangInstanceIdentifier.PathArgument> yangArgs = new LinkedList<>();
final DataContainerCodecContext<?,?> codecContext = getCodecContextNode(path, yangArgs);
return new SimpleEntry<>(YangInstanceIdentifier.create(yangArgs), codecContext.createWriter(domWriter));
}
代码示例来源:origin: opendaylight/yangtools
@Nonnull
@Override
YangInstanceIdentifier createRelativeIdentifier(final int skipFromRoot) {
// TODO: can we optimize this one?
return YangInstanceIdentifier.create(Iterables.skip(getPathArguments(), skipFromRoot));
}
代码示例来源:origin: org.opendaylight.yangtools/yang-data-api
@Nonnull
@Override
YangInstanceIdentifier createRelativeIdentifier(final int skipFromRoot) {
// TODO: can we optimize this one?
return YangInstanceIdentifier.create(Iterables.skip(getPathArguments(), skipFromRoot));
}
代码示例来源:origin: org.opendaylight.yangtools/yang-data-util
@Override
public final YangInstanceIdentifier deserialize(final String data) {
XpathStringParsingPathArgumentBuilder builder = new XpathStringParsingPathArgumentBuilder(this,
requireNonNull(data));
return YangInstanceIdentifier.create(builder.build());
}
代码示例来源:origin: opendaylight/yangtools
@Override
public final YangInstanceIdentifier deserialize(final String data) {
XpathStringParsingPathArgumentBuilder builder = new XpathStringParsingPathArgumentBuilder(this,
requireNonNull(data));
return YangInstanceIdentifier.create(builder.build());
}
代码示例来源:origin: opendaylight/controller
public YangInstanceIdentifier toLegacy(final YangInstanceIdentifier normalized) throws DataNormalizationException {
ImmutableList.Builder<PathArgument> legacyArgs = ImmutableList.builder();
DataNormalizationOperation<?> currentOp = operation;
for (PathArgument normalizedArg : normalized.getPathArguments()) {
currentOp = currentOp.getChild(normalizedArg);
if (!currentOp.isMixin()) {
legacyArgs.add(normalizedArg);
}
}
return YangInstanceIdentifier.create(legacyArgs.build());
}
代码示例来源:origin: org.opendaylight.controller/sal-distributed-datastore
private static YangInstanceIdentifier extractEntityPath(YangInstanceIdentifier candidatePath) {
List<PathArgument> newPathArgs = new ArrayList<>();
for(PathArgument pathArg: candidatePath.getPathArguments()) {
newPathArgs.add(pathArg);
if(pathArg instanceof NodeIdentifierWithPredicates) {
NodeIdentifierWithPredicates nodeKey = (NodeIdentifierWithPredicates) pathArg;
Entry<QName, Object> key = nodeKey.getKeyValues().entrySet().iterator().next();
if(ENTITY_ID_QNAME.equals(key.getKey())) {
break;
}
}
}
return YangInstanceIdentifier.create(newPathArgs);
}
}
代码示例来源:origin: org.opendaylight.controller/sal-clustering-commons
public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path,
QNameDeSerializationContext context) {
List<PathArgument> pathArguments = new ArrayList<>();
for(NormalizedNodeMessages.PathArgument pathArgument : path.getArgumentsList()) {
if(context == null || pathArgument.hasType()) {
pathArguments.add(parsePathArgument(pathArgument));
} else {
pathArguments.add(PathArgumentSerializer.deSerialize(context, pathArgument));
}
}
return YangInstanceIdentifier.create(pathArguments);
}
代码示例来源:origin: org.opendaylight.bgpcep/bgp-rib-spi
private static YangInstanceIdentifier firstIdentifierOf(final YangInstanceIdentifier id, final Predicate<PathArgument> match) {
final int idx = Iterables.indexOf(id.getPathArguments(), match);
Preconditions.checkArgument(idx != -1, "Failed to find %s in %s", match, id);
// we want the element at index idx to be included in the list
return YangInstanceIdentifier.create(Iterables.limit(id.getPathArguments(), idx + 1));
}
内容来源于网络,如有侵权,请联系作者删除!