import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
import org.opendaylight.yangtools.yang.model.api.AugmentationTarget;
import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
@Override
public T getIdentifier() {
return identifier;
- };
+ }
protected DataSchemaContextNode(final T identifier, final SchemaNode schema) {
super();
return Collections.singleton(identifier.getNodeType());
}
- public abstract @Nullable DataSchemaContextNode<?> getChild(final PathArgument child);
-
- public abstract @Nullable DataSchemaContextNode<?> getChild(QName child);
+ @Nullable public abstract DataSchemaContextNode<?> getChild(final PathArgument child);
+
+ @Nullable public abstract DataSchemaContextNode<?> getChild(QName child);
public abstract boolean isLeaf();
- public @Nullable DataSchemaNode getDataSchemaNode() {
+ @Nullable public DataSchemaNode getDataSchemaNode() {
return dataSchemaNode;
}
- static final DataSchemaNode findChildSchemaNode(final DataNodeContainer parent, final QName child) {
+ static DataSchemaNode findChildSchemaNode(final DataNodeContainer parent, final QName child) {
DataSchemaNode potential = parent.getDataChildByName(child);
if (potential == null) {
- Iterable<org.opendaylight.yangtools.yang.model.api.ChoiceNode> choices = FluentIterable.from(
- parent.getChildNodes()).filter(ChoiceNode.class);
+ Iterable<ChoiceSchemaNode> choices = FluentIterable.from(
+ parent.getChildNodes()).filter(ChoiceSchemaNode.class);
potential = findChoice(choices, child);
}
return potential;
static DataSchemaContextNode<?> fromSchemaAndQNameChecked(final DataNodeContainer schema, final QName child) {
DataSchemaNode result = findChildSchemaNode(schema, child);
// We try to look up if this node was added by augmentation
- if ((schema instanceof DataSchemaNode) && result.isAugmenting()) {
+ if (result != null && (schema instanceof DataSchemaNode) && result.isAugmenting()) {
return fromAugmentation(schema, (AugmentationTarget) schema, result);
}
return fromDataSchemaNode(result);
}
- private static org.opendaylight.yangtools.yang.model.api.ChoiceNode findChoice(
- final Iterable<org.opendaylight.yangtools.yang.model.api.ChoiceNode> choices, final QName child) {
- org.opendaylight.yangtools.yang.model.api.ChoiceNode foundChoice = null;
- choiceLoop: for (org.opendaylight.yangtools.yang.model.api.ChoiceNode choice : choices) {
+ private static ChoiceSchemaNode findChoice(final Iterable<ChoiceSchemaNode> choices, final QName child) {
+ ChoiceSchemaNode foundChoice = null;
+ choiceLoop: for (ChoiceSchemaNode choice : choices) {
for (ChoiceCaseNode caze : choice.getCases()) {
if (findChildSchemaNode(caze, child) != null) {
foundChoice = choice;
* @param child
* @return
*/
- static @Nullable DataSchemaContextNode<?> fromAugmentation(final DataNodeContainer parent,
+ @Nullable static DataSchemaContextNode<?> fromAugmentation(final DataNodeContainer parent,
final AugmentationTarget parentAug, final DataSchemaNode child) {
AugmentationSchema augmentation = null;
for (AugmentationSchema aug : parentAug.getAvailableAugmentations()) {
return fromDataSchemaNode(child);
}
- public static @Nullable DataSchemaContextNode<?> fromDataSchemaNode(final DataSchemaNode potential) {
+ @Nullable public static DataSchemaContextNode<?> fromDataSchemaNode(final DataSchemaNode potential) {
if (potential instanceof ContainerSchemaNode) {
return new ContainerContextNode((ContainerSchemaNode) potential);
} else if (potential instanceof ListSchemaNode) {
return fromListSchemaNode((ListSchemaNode) potential);
} else if (potential instanceof LeafSchemaNode) {
return new LeafContextNode((LeafSchemaNode) potential);
- } else if (potential instanceof org.opendaylight.yangtools.yang.model.api.ChoiceNode) {
- return new ChoiceNodeContextNode((org.opendaylight.yangtools.yang.model.api.ChoiceNode) potential);
+ } else if (potential instanceof ChoiceSchemaNode) {
+ return new ChoiceNodeContextNode((ChoiceSchemaNode) potential);
} else if (potential instanceof LeafListSchemaNode) {
return fromLeafListSchemaNode((LeafListSchemaNode) potential);
} else if (potential instanceof AnyXmlSchemaNode) {