}
return potential;
}
+
+ private static DataNormalizationOperation<?> fromSchemaAndQNameChecked(final DataNodeContainer schema,
+ final QName child) throws DataNormalizationException {
+
+ final Optional<DataSchemaNode> potential = findChildSchemaNode(schema, child);
+ if (!potential.isPresent()) {
+ throw new DataNormalizationException(String.format(
+ "Supplied QName %s is not valid according to schema %s, potential children nodes: %s", child,
+ schema,schema.getChildNodes()));
+ }
+
+ final DataSchemaNode result = potential.get();
+ // We try to look up if this node was added by augmentation
+ if (schema instanceof DataSchemaNode && result.isAugmenting()) {
+ return fromAugmentation(schema, (AugmentationTarget) schema, result);
+ }
+ return fromDataSchemaNode(result);
+ }
}
private static final class ListItemNormalization extends
super(augmentationIdentifierFrom(augmentation), augmentationProxy(augmentation,schema),null);
}
+ private static DataNodeContainer augmentationProxy(final AugmentationSchemaNode augmentation,
+ final DataNodeContainer schema) {
+ final Set<DataSchemaNode> children = new HashSet<>();
+ for (final DataSchemaNode augNode : augmentation.getChildNodes()) {
+ children.add(schema.getDataChildByName(augNode.getQName()));
+ }
+ return new EffectiveAugmentationSchema(augmentation, children);
+ }
+
@Override
public boolean isMixin() {
return true;
public NormalizedNode<?, ?> createDefault(final PathArgument currentArg) {
return Builders.augmentationBuilder().withNodeIdentifier(getIdentifier()).build();
}
-
}
private static class UnorderedMapMixinNormalization extends MixinNormalizationOp<NodeIdentifier> {
return Optional.fromNullable(potential);
}
- private static DataNormalizationOperation<?> fromSchemaAndQNameChecked(final DataNodeContainer schema,
- final QName child) throws DataNormalizationException {
-
- final Optional<DataSchemaNode> potential = findChildSchemaNode(schema, child);
- if (!potential.isPresent()) {
- throw new DataNormalizationException(String.format(
- "Supplied QName %s is not valid according to schema %s, potential children nodes: %s", child,
- schema,schema.getChildNodes()));
- }
-
- final DataSchemaNode result = potential.get();
- // We try to look up if this node was added by augmentation
- if (schema instanceof DataSchemaNode && result.isAugmenting()) {
- return fromAugmentation(schema, (AugmentationTarget) schema, result);
- }
- return fromDataSchemaNode(result);
- }
-
private static ChoiceSchemaNode findChoice(final Iterable<ChoiceSchemaNode> choices, final QName child) {
ChoiceSchemaNode foundChoice = null;
choiceLoop: for (final ChoiceSchemaNode choice : choices) {
return new AugmentationIdentifier(potentialChildren.build());
}
- private static DataNodeContainer augmentationProxy(final AugmentationSchemaNode augmentation,
- final DataNodeContainer schema) {
- final Set<DataSchemaNode> children = new HashSet<>();
- for (final DataSchemaNode augNode : augmentation.getChildNodes()) {
- children.add(schema.getDataChildByName(augNode.getQName()));
- }
- return new EffectiveAugmentationSchema(augmentation, children);
- }
-
/**
* Returns a DataNormalizationOperation for provided child node.
*