/** * Creates package name from specified <code>basePackageName</code> (package name for module) and * <code>schemaPath</code>. * * <p>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 * @param schemaPath list of names of YANG nodes which are parents of some node + name of this * node * @param isUsesAugment boolean true if using augment * @return string with valid JAVA package name * @deprecated Use {@link #packageNameForGeneratedType(String, SchemaPath)} or {@link * #packageNameForAugmentedGeneratedType(String, SchemaPath)} instead. */ @Deprecated public static String packageNameForGeneratedType( final String basePackageName, final SchemaPath schemaPath, final boolean isUsesAugment) { if (basePackageName == null) { throw new IllegalArgumentException("Base Package Name cannot be NULL!"); } if (schemaPath == null) { throw new IllegalArgumentException("Schema Path cannot be NULL!"); } final Iterable<QName> iterable = schemaPath.getPathFromRoot(); final int size = Iterables.size(iterable); final int traversalSteps; if (isUsesAugment) { traversalSteps = size; } else { traversalSteps = size - 1; } if (traversalSteps == 0) { return BindingMapping.normalizePackageName(basePackageName); } return generateNormalizedPackageName(basePackageName, iterable, traversalSteps); }
/** * Creates package name from specified <code>basePackageName</code> (package name for module) and * <code>schemaPath</code> which crosses an augmentation. * * <p>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); }