import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
-import javax.annotation.Nullable;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.util.EffectiveAugmentationSchema;
/**
* Schema derived data providing necessary information for mapping between
* @param child Child path argument
* @return A child node, or null if not found
*/
- @Nullable public abstract DataSchemaContextNode<?> getChild(PathArgument child);
+ public abstract @Nullable DataSchemaContextNode<?> getChild(PathArgument child);
- @Nullable public abstract DataSchemaContextNode<?> getChild(QName child);
+ public abstract @Nullable DataSchemaContextNode<?> getChild(QName child);
- @Nullable public DataSchemaNode getDataSchemaNode() {
+ public @Nullable DataSchemaNode getDataSchemaNode() {
return dataSchemaNode;
}
.collect(Collectors.toSet()));
}
- /**
- * Returns an AugmentationSchemaNode as effective in a parent node.
- *
- * @param schema Augmentation schema
- * @param parent Parent schema
- * @return Adjusted Augmentation schema
- * @throws NullPointerException if any of the arguments is null
- * @deprecated Use {@link EffectiveAugmentationSchema#create(AugmentationSchemaNode, DataNodeContainer)} instead.
- */
- @Deprecated
- public static AugmentationSchemaNode augmentationProxy(final AugmentationSchemaNode schema,
- final DataNodeContainer parent) {
- return EffectiveAugmentationSchema.create(schema, parent);
- }
-
/**
* Returns a DataContextNodeOperation for provided child node
*
* DataContextNodeOperation for child as call for
* {@link #fromDataSchemaNode(DataSchemaNode)}.
*/
- @Nullable static DataSchemaContextNode<?> fromAugmentation(final DataNodeContainer parent,
+ static @Nullable DataSchemaContextNode<?> fromAugmentation(final DataNodeContainer parent,
final AugmentationTarget parentAug, final DataSchemaNode child) {
- AugmentationSchemaNode augmentation = null;
for (AugmentationSchemaNode aug : parentAug.getAvailableAugmentations()) {
- DataSchemaNode potential = aug.getDataChildByName(child.getQName());
- if (potential != null) {
- augmentation = aug;
- break;
+ if (aug.findDataChildByName(child.getQName()).isPresent()) {
+ return new AugmentationContextNode(aug, parent);
}
}
- if (augmentation != null) {
- return new AugmentationContextNode(augmentation, parent);
- }
return fromDataSchemaNode(child);
}
- @Nullable public static DataSchemaContextNode<?> fromDataSchemaNode(final DataSchemaNode potential) {
+ public static @Nullable DataSchemaContextNode<?> fromDataSchemaNode(final DataSchemaNode potential) {
if (potential instanceof ContainerSchemaNode) {
return new ContainerContextNode((ContainerSchemaNode) potential);
} else if (potential instanceof ListSchemaNode) {