private ImmutableList<QName> getLegacyPath() { ImmutableList<QName> ret = legacyPath; if (ret == null) { final List<QName> tmp = new ArrayList<>(); for (QName item : getPathTowardsRoot()) { tmp.add(item); } ret = ImmutableList.copyOf(Lists.reverse(tmp)); LEGACYPATH_UPDATER.lazySet(this, ret); } return ret; }
private ImmutableList<QName> getLegacyPath() { ImmutableList<QName> ret = legacyPath; if (ret == null) { final List<QName> tmp = new ArrayList<>(); for (QName item : getPathTowardsRoot()) { tmp.add(item); } ret = ImmutableList.copyOf(Lists.reverse(tmp)); LEGACYPATH_UPDATER.lazySet(this, ret); } return ret; }
/** * Creates package name from specified <code>basePackageName</code> (package name for module) * and <code>schemaPath</code>. Resulting package name is concatenation of <code>basePackageName</code> * and all local names of YANG nodes which are parents of some node for which <code>schemaPath</code> is specified. * * @param basePackageName string with package name of the module, MUST be normalized, otherwise this method may * return an invalid string. * @param schemaPath list of names of YANG nodes which are parents of some node + name of this node * @return string with valid JAVA package name * @throws NullPointerException if any of the arguments are null */ public static String packageNameForGeneratedType(final String basePackageName, final SchemaPath schemaPath) { final int size = Iterables.size(schemaPath.getPathTowardsRoot()) - 1; if (size <= 0) { return basePackageName; } return generateNormalizedPackageName(basePackageName, schemaPath.getPathFromRoot(), size); }
/** * Creates package name from specified <code>basePackageName</code> (package name for module) * and <code>schemaPath</code> which crosses an augmentation. Resulting package name is concatenation * of <code>basePackageName</code> and all local names of YANG nodes which are parents of some node for which * <code>schemaPath</code> is specified. * * @param basePackageName string with package name of the module, MUST be normalized, otherwise this method may * return an invalid string. * @param schemaPath list of names of YANG nodes which are parents of some node + name of this node * @return string with valid JAVA package name * @throws NullPointerException if any of the arguments are null */ public static String packageNameForAugmentedGeneratedType(final String basePackageName, final SchemaPath schemaPath) { final int size = Iterables.size(schemaPath.getPathTowardsRoot()); if (size == 0) { return basePackageName; } return generateNormalizedPackageName(basePackageName, schemaPath.getPathFromRoot(), size); }
final Iterable<QName> pathTowardsRoot = schemaPath.getPathTowardsRoot(); final Iterable<QName> pathFromRoot = schemaPath.getPathFromRoot(); final int size = Iterables.size(pathTowardsRoot);
BindingNamespaceType namespaceType) { final Iterable<QName> pathTowardsRoot = schemaPath.getPathTowardsRoot(); final Iterable<QName> pathFromRoot = schemaPath.getPathFromRoot(); final int size = Iterables.size(pathTowardsRoot) - 1;
/** * Resolve path argument name for {@code node}. * * <p>The name can contain also prefix which consists of module name followed by colon. The module * prefix is presented if namespace of {@code node} and its parent is different. In other cases * only name of {@code node} is returned. * * @return name of {@code node} */ public static String resolvePathArgumentsName(final SchemaNode node, final SchemaContext schemaContext) { Iterable<QName> schemaPath = node.getPath().getPathTowardsRoot(); Iterator<QName> it = schemaPath.iterator(); QName nodeQName = it.next(); QName parentQName = null; if (it.hasNext()) { parentQName = it.next(); } if (isEqualNamespaceAndRevision(parentQName, nodeQName)) { return node.getQName().getLocalName(); } else { return resolveFullNameFromNode(node, schemaContext); } }