Choices seem to have this special case, which we should be able to
wire without an explicit cast in most cases.
Change-Id: I5a398957190ccec49b2a9072638f489bbdabd984
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
*/
package org.opendaylight.yangtools.yang.data.util;
*/
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.StreamWriterMetadataExtension;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
import java.io.IOException;
import org.opendaylight.yangtools.rfc7952.data.api.StreamWriterMetadataExtension;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
/**
* childs - empty augment - only one element can be.
*/
/**
* 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);
}
private CaseNodeDataWithSchema caseNodeDataWithSchema;
ChoiceNodeDataWithSchema(final ChoiceSchemaNode schema) {
super(schema);
}
+ // FIXME: 6.0.0: this should be impossible to hit
- protected CaseNodeDataWithSchema addCompositeChild(final DataSchemaNode schema) {
- CaseNodeDataWithSchema newChild = new CaseNodeDataWithSchema((CaseSchemaNode) schema);
+ CaseNodeDataWithSchema addCompositeChild(final DataSchemaNode schema) {
+ verify(schema instanceof CaseSchemaNode, "Unexpected schema %s", schema);
+ return addCompositeChild((CaseSchemaNode) schema);
+ }
+
+ CaseNodeDataWithSchema addCompositeChild(final CaseSchemaNode schema) {
+ CaseNodeDataWithSchema newChild = new CaseNodeDataWithSchema(schema);
caseNodeDataWithSchema = newChild;
addCompositeChild(newChild);
return newChild;
}
caseNodeDataWithSchema = newChild;
addCompositeChild(newChild);
return newChild;
}
- public CaseNodeDataWithSchema getCase() {
+ CaseNodeDataWithSchema getCase() {
return caseNodeDataWithSchema;
}
return caseNodeDataWithSchema;
}