*/
package org.opendaylight.yangtools.yang.data.util;
+import static com.google.common.base.Verify.verify;
+
import java.io.IOException;
-import org.opendaylight.yangtools.rfc7952.data.api.NormalizedMetadataStreamWriter;
+import org.opendaylight.yangtools.rfc7952.data.api.StreamWriterMetadataExtension;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
/**
* childs - empty augment - only one element can be.
*/
-class ChoiceNodeDataWithSchema extends CompositeNodeDataWithSchema<ChoiceSchemaNode> {
+final class ChoiceNodeDataWithSchema extends CompositeNodeDataWithSchema<ChoiceSchemaNode> {
private CaseNodeDataWithSchema caseNodeDataWithSchema;
ChoiceNodeDataWithSchema(final ChoiceSchemaNode schema) {
super(schema);
}
+ // FIXME: 6.0.0: this should be impossible to hit
@Override
- protected CaseNodeDataWithSchema addCompositeChild(final DataSchemaNode schema) {
- CaseNodeDataWithSchema newChild = new CaseNodeDataWithSchema((CaseSchemaNode) schema);
+ CaseNodeDataWithSchema addCompositeChild(final DataSchemaNode schema, final ChildReusePolicy policy) {
+ verify(schema instanceof CaseSchemaNode, "Unexpected schema %s", schema);
+ return addCompositeChild((CaseSchemaNode) schema, policy);
+ }
+
+ CaseNodeDataWithSchema addCompositeChild(final CaseSchemaNode schema, final ChildReusePolicy policy) {
+ CaseNodeDataWithSchema newChild = new CaseNodeDataWithSchema(schema);
caseNodeDataWithSchema = newChild;
- addCompositeChild(newChild);
+ addCompositeChild(newChild, policy);
return newChild;
}
- public CaseNodeDataWithSchema getCase() {
+ CaseNodeDataWithSchema getCase() {
return caseNodeDataWithSchema;
}
@Override
- public void write(final NormalizedNodeStreamWriter writer, final NormalizedMetadataStreamWriter metaWriter)
+ public void write(final NormalizedNodeStreamWriter writer, final StreamWriterMetadataExtension metaWriter)
throws IOException {
writer.nextDataSchemaNode(getSchema());
writer.startChoiceNode(provideNodeIdentifier(), childSizeHint());