private GroupingDefinition findUsedGrouping(final UsesNode uses) { final SchemaNode targetGrouping = findNodeInSchemaContext(schemaContext, uses.getGroupingPath() .getPathFromRoot()); if (targetGrouping instanceof GroupingDefinition) { return (GroupingDefinition) targetGrouping; } throw new IllegalArgumentException("Failed to resolve used grouping for " + uses); }
/** * Method attempts to find DataSchemaNode in Schema Context via specified * Schema Path. The returned DataSchemaNode from method will be the node at * the end of the SchemaPath. If the DataSchemaNode is not present in the * Schema Context the method will return <code>null</code>. <br> * In case that Schema Context or Schema Path are not specified correctly * (i.e. contains <code>null</code> values) the method will throw * IllegalArgumentException. * * @param context * Schema Context * @param schemaPath * Schema Path to search for * @return SchemaNode from the end of the Schema Path or <code>null</code> * if the Node is not present. * @throws IllegalArgumentException if context or schemaPath is not correct. */ public static SchemaNode findDataSchemaNode(final SchemaContext context, final SchemaPath schemaPath) { checkArgument(context != null, "Schema Context reference cannot be NULL"); checkArgument(schemaPath != null, "Schema Path reference cannot be NULL"); final Iterable<QName> prefixedPath = schemaPath.getPathFromRoot(); if (prefixedPath == null) { LOG.debug("Schema path {} has null path", schemaPath); return null; } LOG.trace("Looking for path {} in context {}", schemaPath, context); return findNodeInSchemaContext(context, prefixedPath); }
/** * Method attempts to find DataSchemaNode in Schema Context via specified * Schema Path. The returned DataSchemaNode from method will be the node at * the end of the SchemaPath. If the DataSchemaNode is not present in the * Schema Context the method will return <code>null</code>. <br> * In case that Schema Context or Schema Path are not specified correctly * (i.e. contains <code>null</code> values) the method will throw * IllegalArgumentException. * * @param context * Schema Context * @param schemaPath * Schema Path to search for * @return SchemaNode from the end of the Schema Path or <code>null</code> * if the Node is not present. * @throws IllegalArgumentException if context or schemaPath is not correct. */ public static SchemaNode findDataSchemaNode(final SchemaContext context, final SchemaPath schemaPath) { checkArgument(context != null, "Schema Context reference cannot be NULL"); checkArgument(schemaPath != null, "Schema Path reference cannot be NULL"); final Iterable<QName> prefixedPath = schemaPath.getPathFromRoot(); if (prefixedPath == null) { LOG.debug("Schema path {} has null path", schemaPath); return null; } LOG.trace("Looking for path {} in context {}", schemaPath, context); return findNodeInSchemaContext(context, prefixedPath); }
return pureData.isPresent() ? pureData.get() : findNodeInSchemaContext(context, path);
return pureData.isPresent() ? pureData.get() : findNodeInSchemaContext(context, path);
return pureData.isPresent() ? pureData.get() : findNodeInSchemaContext(context, qnamePath);
return pureData.isPresent() ? pureData.get() : findNodeInSchemaContext(context, qnamePath);
final SchemaNode targetGrouping = findNodeInSchemaContext(schemaContext, parentUsesNode.getGroupingPath() .getPathFromRoot()); if (!(targetGrouping instanceof GroupingDefinition)) {