import org.opendaylight.yangtools.yang.binding.DataObjectSerializerImplementation;
import org.opendaylight.yangtools.yang.binding.DataObjectSerializerRegistry;
import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
-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;
emitList(b, getterName, valueType, casted);
} else if (child instanceof ContainerSchemaNode) {
b.append(statement(staticInvokeEmitter(childType, getterName)));
- } else if (child instanceof ChoiceNode) {
+ } else if (child instanceof ChoiceSchemaNode) {
String propertyName = CHOICE_PREFIX + childType.getName();
staticConstant(propertyName, DataObjectSerializerImplementation.class, ChoiceDispatchSerializer.from(loadClass(childType)));
b.append(statement(invoke(propertyName, StreamWriterGenerator.SERIALIZE_METHOD_NAME, REGISTRY, cast(DataObject.class.getName(),getterName), STREAM)));
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
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.DataSchemaNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-final class ChoiceNodeCodecContext extends DataContainerCodecContext<ChoiceNode> {
+final class ChoiceNodeCodecContext extends DataContainerCodecContext<ChoiceSchemaNode> {
private static final Logger LOG = LoggerFactory.getLogger(ChoiceNodeCodecContext.class);
private final ImmutableMap<YangInstanceIdentifier.PathArgument, DataContainerCodecPrototype<?>> byYangCaseChild;
private final ImmutableMap<Class<?>, DataContainerCodecPrototype<?>> byClass;
private final ImmutableMap<Class<?>, DataContainerCodecPrototype<?>> byCaseChildClass;
- public ChoiceNodeCodecContext(final DataContainerCodecPrototype<ChoiceNode> prototype) {
+ public ChoiceNodeCodecContext(final DataContainerCodecPrototype<ChoiceSchemaNode> prototype) {
super(prototype);
Map<YangInstanceIdentifier.PathArgument, DataContainerCodecPrototype<?>> byYangCaseChildBuilder = new HashMap<>();
Map<Class<?>, DataContainerCodecPrototype<?>> byClassBuilder = new HashMap<>();
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
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.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
} else {
return new ListNodeCodecContext((DataContainerCodecPrototype) this);
}
- } else if (schema instanceof ChoiceNode) {
+ } else if (schema instanceof ChoiceSchemaNode) {
return new ChoiceNodeCodecContext((DataContainerCodecPrototype) this);
} else if (schema instanceof AugmentationSchema) {
return new AugmentationNodeContext((DataContainerCodecPrototype) this);
}
boolean isChoice() {
- return schema instanceof ChoiceNode;
+ return schema instanceof ChoiceSchemaNode;
}
}
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-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;
Preconditions.checkArgument(childSchema != null, "Argument %s is not valid child of %s", qname,
schema());
- if (childSchema instanceof DataNodeContainer || childSchema instanceof ChoiceNode) {
+ if (childSchema instanceof DataNodeContainer || childSchema instanceof ChoiceSchemaNode) {
final Class<?> childCls = factory().getRuntimeContext().getClassForSchema(childSchema);
return getStreamChild(childCls);
} else {
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
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;
throw new NullPointerException("Target type not yet generated: " + targetSchemaNode);
}
- if (!(targetSchemaNode instanceof ChoiceNode)) {
+ if (!(targetSchemaNode instanceof ChoiceSchemaNode)) {
String packageName = augmentPackageName;
final Type targetType = new ReferencedTypeImpl(targetTypeBuilder.getPackageName(),
targetTypeBuilder.getName());
} else {
generateTypesFromAugmentedChoiceCases(module, augmentPackageName, targetTypeBuilder.toInstance(),
- (ChoiceNode) targetSchemaNode, augSchema.getChildNodes());
+ (ChoiceSchemaNode) targetSchemaNode, augSchema.getChildNodes());
}
}
throw new NullPointerException("Target type not yet generated: " + targetSchemaNode);
}
- if (!(targetSchemaNode instanceof ChoiceNode)) {
+ if (!(targetSchemaNode instanceof ChoiceSchemaNode)) {
String packageName = augmentPackageName;
if (usesNodeParent instanceof SchemaNode) {
packageName = packageNameForGeneratedType(augmentPackageName, ((SchemaNode) usesNodeParent).getPath(),
augSchema);
} else {
generateTypesFromAugmentedChoiceCases(module, augmentPackageName, targetTypeBuilder.toInstance(),
- (ChoiceNode) targetSchemaNode, augSchema.getChildNodes());
+ (ChoiceSchemaNode) targetSchemaNode, augSchema.getChildNodes());
}
}
// with same name and different namespace
if (result instanceof DataNodeContainer) {
result = ((DataNodeContainer) result).getDataChildByName(node.getLocalName());
- } else if (result instanceof ChoiceNode) {
- result = ((ChoiceNode) result).getCaseNodeByName(node.getLocalName());
+ } else if (result instanceof ChoiceSchemaNode) {
+ result = ((ChoiceSchemaNode) result).getCaseNodeByName(node.getLocalName());
}
}
if (result == null) {
containerToGenType(module, basePackageName, typeBuilder, childOf, (ContainerSchemaNode) node);
} else if (node instanceof ListSchemaNode) {
listToGenType(module, basePackageName, typeBuilder, childOf, (ListSchemaNode) node);
- } else if (node instanceof ChoiceNode) {
- choiceToGeneratedType(module, basePackageName, typeBuilder, (ChoiceNode) node);
+ } else if (node instanceof ChoiceSchemaNode) {
+ choiceToGeneratedType(module, basePackageName, typeBuilder, (ChoiceSchemaNode) node);
} else {
// TODO: anyxml not yet supported
LOG.debug("Unable to add schema node {} as method in {}: unsupported type of node.", node.getClass(),
* </ul>
*/
private void choiceToGeneratedType(final Module module, final String basePackageName,
- final GeneratedTypeBuilder parent, final ChoiceNode choiceNode) {
+ final GeneratedTypeBuilder parent, final ChoiceSchemaNode choiceNode) {
checkArgument(basePackageName != null, "Base Package Name cannot be NULL.");
checkArgument(choiceNode != null, "Choice Schema Node cannot be NULL.");
* </ul>
*/
private void generateTypesFromChoiceCases(final Module module, final String basePackageName,
- final Type refChoiceType, final ChoiceNode choiceNode) {
+ final Type refChoiceType, final ChoiceSchemaNode choiceNode) {
checkArgument(basePackageName != null, "Base Package Name cannot be NULL.");
checkArgument(refChoiceType != null, "Referenced Choice Type cannot be NULL.");
checkArgument(choiceNode != null, "ChoiceNode cannot be NULL.");
* </ul>
*/
private void generateTypesFromAugmentedChoiceCases(final Module module, final String basePackageName,
- final Type targetType, final ChoiceNode targetNode, final Iterable<DataSchemaNode> augmentedNodes) {
+ final Type targetType, final ChoiceSchemaNode targetNode, final Iterable<DataSchemaNode> augmentedNodes) {
checkArgument(basePackageName != null, "Base Package Name cannot be NULL.");
checkArgument(targetType != null, "Referenced Choice Type cannot be NULL.");
checkArgument(augmentedNodes != null, "Set of Choice Case Nodes cannot be NULL.");
resolveLeafListSchemaNode(typeBuilder, (LeafListSchemaNode) schemaNode);
} else if (schemaNode instanceof ContainerSchemaNode) {
containerToGenType(module, basePackageName, typeBuilder, typeBuilder, (ContainerSchemaNode) schemaNode);
- } else if (schemaNode instanceof ChoiceNode) {
- choiceToGeneratedType(module, basePackageName, typeBuilder, (ChoiceNode) schemaNode);
+ } else if (schemaNode instanceof ChoiceSchemaNode) {
+ choiceToGeneratedType(module, basePackageName, typeBuilder, (ChoiceSchemaNode) schemaNode);
} else if (schemaNode instanceof ListSchemaNode) {
listToGenType(module, basePackageName, typeBuilder, typeBuilder, (ListSchemaNode) schemaNode);
}
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.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
final QName targetQName) {
for (DataSchemaNode child : ctx.getChildNodes()) {
- if (child instanceof ChoiceNode) {
- DataNodeContainer potential = findInCases(((ChoiceNode) child), targetQName);
+ if (child instanceof ChoiceSchemaNode) {
+ DataNodeContainer potential = findInCases(((ChoiceSchemaNode) child), targetQName);
if (potential != null) {
return Optional.of(potential);
}
return Optional.absent();
}
- private static DataNodeContainer findInCases(final ChoiceNode choiceNode, final QName targetQName) {
+ private static DataNodeContainer findInCases(final ChoiceSchemaNode choiceNode, final QName targetQName) {
for (ChoiceCaseNode caze : choiceNode.getCases()) {
Optional<DataNodeContainer> potential = findDataNodeContainer(caze, targetQName);
if (potential.isPresent()) {
return augmentations;
}
- public static Optional<ChoiceNode> findInstantiatedChoice(final DataNodeContainer parent, final Class<?> choiceClass) {
+ public static Optional<ChoiceSchemaNode> findInstantiatedChoice(final DataNodeContainer parent, final Class<?> choiceClass) {
return findInstantiatedChoice(parent, BindingReflections.findQName(choiceClass));
}
- public static Optional<ChoiceNode> findInstantiatedChoice(final DataNodeContainer ctxNode, final QName choiceName) {
+ public static Optional<ChoiceSchemaNode> findInstantiatedChoice(final DataNodeContainer ctxNode, final QName choiceName) {
DataSchemaNode potential = ctxNode.getDataChildByName(choiceName);
if (potential == null) {
potential = ctxNode.getDataChildByName(choiceName.getLocalName());
}
- if (potential instanceof ChoiceNode) {
- return Optional.of((ChoiceNode) potential);
+ if (potential instanceof ChoiceSchemaNode) {
+ return Optional.of((ChoiceSchemaNode) potential);
}
return Optional.absent();
}
- public static Optional<ChoiceCaseNode> findInstantiatedCase(final ChoiceNode instantiatedChoice, final ChoiceCaseNode originalDefinition) {
+ public static Optional<ChoiceCaseNode> findInstantiatedCase(final ChoiceSchemaNode instantiatedChoice, final ChoiceCaseNode originalDefinition) {
ChoiceCaseNode potential = instantiatedChoice.getCaseNodeByName(originalDefinition.getQName());
if(originalDefinition.equals(potential)) {
return Optional.of(potential);
package org.opendaylight.yangtools.sal.binding.generator.impl;
import java.util.Map;
-
import org.opendaylight.yangtools.yang.binding.BindingCodec;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
public interface GeneratorListener {
void onClassProcessed(Class<?> cl);
void onDataContainerCodecCreated(Class<?> dataClass, Class<? extends BindingCodec<?, ?>> dataCodec);
void onChoiceCodecCreated(Class<?> choiceClass,
- Class<? extends BindingCodec<Map<QName, Object>, Object>> choiceCodec, ChoiceNode schema);
+ Class<? extends BindingCodec<Map<QName, Object>, Object>> choiceCodec, ChoiceSchemaNode schema);
}
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.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
private DataSchemaNode searchInChoices(final DataNodeContainer node, final QName arg) {
for (DataSchemaNode child : node.getChildNodes()) {
- if (child instanceof ChoiceNode) {
- ChoiceNode choiceNode = (ChoiceNode) child;
+ if (child instanceof ChoiceSchemaNode) {
+ ChoiceSchemaNode choiceNode = (ChoiceSchemaNode) child;
DataSchemaNode potential = searchInCases(choiceNode, arg);
if (potential != null) {
return potential;
return null;
}
- private DataSchemaNode searchInCases(final ChoiceNode choiceNode, final QName arg) {
+ private DataSchemaNode searchInCases(final ChoiceSchemaNode choiceNode, final QName arg) {
Set<ChoiceCaseNode> cases = choiceNode.getCases();
for (ChoiceCaseNode caseNode : cases) {
DataSchemaNode node = caseNode.getDataChildByName(arg);
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void onChoiceCodecCreated(final Class<?> choiceClass,
- final Class<? extends BindingCodec<Map<QName, Object>, Object>> choiceCodec, final ChoiceNode schema) {
+ final Class<? extends BindingCodec<Map<QName, Object>, Object>> choiceCodec, final ChoiceSchemaNode schema) {
ChoiceCodec<?> oldCodec = choiceCodecs.get(choiceClass);
Preconditions.checkState(oldCodec == null);
BindingCodec<Map<QName, Object>, Object> delegate = newInstanceOf(choiceCodec);
@Override
protected void adaptForPathImpl(final InstanceIdentifier<?> augTarget, final DataNodeContainer ctxNode) {
tryToLoadImplementations();
- Optional<ChoiceNode> newChoice = BindingSchemaContextUtils.findInstantiatedChoice(ctxNode, choiceType);
+ Optional<ChoiceSchemaNode> newChoice = BindingSchemaContextUtils.findInstantiatedChoice(ctxNode, choiceType);
if(!newChoice.isPresent()) {
// Choice is nested inside other choice, so we need to look two levels deep.
in_choices: for(DataSchemaNode child : ctxNode.getChildNodes()) {
- if(child instanceof ChoiceNode) {
- Optional<ChoiceNode> potential = findChoiceInChoiceCases((ChoiceNode) child, choiceType);
+ if (child instanceof ChoiceSchemaNode) {
+ Optional<ChoiceSchemaNode> potential = findChoiceInChoiceCases((ChoiceSchemaNode) child, choiceType);
if(potential.isPresent()) {
newChoice = potential;
break in_choices;
}
}
- private Optional<ChoiceNode> findChoiceInChoiceCases(final ChoiceNode choice, final Class<?> choiceType) {
+ private Optional<ChoiceSchemaNode> findChoiceInChoiceCases(final ChoiceSchemaNode choice, final Class<?> choiceType) {
for(ChoiceCaseNode caze : choice.getCases()) {
- Optional<ChoiceNode> potential = BindingSchemaContextUtils.findInstantiatedChoice(caze, choiceType);
+ Optional<ChoiceSchemaNode> potential = BindingSchemaContextUtils.findInstantiatedChoice(caze, choiceType);
if(potential.isPresent()) {
return potential;
}
*/
package org.opendaylight.yangtools.sal.binding.generator.impl
+import static com.google.common.base.Preconditions.*
+import static javassist.Modifier.*
+import static org.opendaylight.yangtools.sal.binding.generator.impl.CodecMapping.*
+
+import static extension org.opendaylight.yangtools.sal.binding.generator.util.YangSchemaUtils.*
+
import com.google.common.base.Joiner
import com.google.common.base.Supplier
import java.io.File
import org.opendaylight.yangtools.yang.common.QName
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema
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
import org.opendaylight.yangtools.yang.model.util.ExtendedType
import org.slf4j.LoggerFactory
-import static com.google.common.base.Preconditions.*
-import static javassist.Modifier.*
-import static org.opendaylight.yangtools.sal.binding.generator.impl.CodecMapping.*
-
-import static extension org.opendaylight.yangtools.sal.binding.generator.util.YangSchemaUtils.*
-
class TransformerGenerator extends AbstractTransformerGenerator {
private static val LOG = LoggerFactory.getLogger(TransformerGenerator)
val Map<String, Type> properties = typeSpec.allProperties
if (node instanceof DataNodeContainer) {
mappingForNodes((node as DataNodeContainer).childNodes, properties, parent)
- } else if (node instanceof ChoiceNode) {
- mappingForNodes((node as ChoiceNode).cases, properties, parent)
+ } else if (node instanceof ChoiceSchemaNode) {
+ mappingForNodes((node as ChoiceSchemaNode).cases, properties, parent)
}
return null ]
ClassLoaderUtils.withClassLoader(cl, sup)
}
private def dispatch Class<? extends BindingCodec<Map<QName, Object>, Object>> generateTransformerFor(
- Class<?> inputType, GeneratedType typeSpec, ChoiceNode node) {
+ Class<?> inputType, GeneratedType typeSpec, ChoiceSchemaNode node) {
try {
val SourceCodeGenerator sourceGenerator = sourceCodeGeneratorFactory.getInstance( null );
}
'''
- private def dispatch CharSequence deserializeProperty(ChoiceNode schema, Type type, String propertyName) '''
+ private def dispatch CharSequence deserializeProperty(ChoiceSchemaNode schema, Type type, String propertyName) '''
«type.resolvedName» «propertyName» = «type.serializer(schema).resolvedName».fromDomStatic(_localQName,_compositeNode,$3);
if(«propertyName» != null) {
_is_empty = false;
}
'''
- private def dispatch CharSequence serializeProperty(ChoiceNode container, GeneratedType type,
+ private def dispatch CharSequence serializeProperty(ChoiceSchemaNode container, GeneratedType type,
String propertyName) '''
«type.resolvedName» «propertyName» = value.«propertyName»();
if(«propertyName» != null) {
import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema
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.DataSchemaNode
import org.opendaylight.yangtools.yang.model.api.Deviation
'''
}
- def static writeChoiceNode(ChoiceNode choiceNode) {
+ def static writeChoiceNode(ChoiceSchemaNode choiceNode) {
'''
choice «choiceNode.getQName.localName» {
«FOR child : choiceNode.cases»
«IF child instanceof ChoiceCaseNode»
«writeChoiceCaseNode(child)»
«ENDIF»
- «IF child instanceof ChoiceNode»
+ «IF child instanceof ChoiceSchemaNode»
«writeChoiceNode(child)»
«ENDIF»
«IF child instanceof ListSchemaNode»
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.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
* the given context.
* @throws IllegalArgumentException If supplied class does not represent case.
*/
- public Optional<ChoiceCaseNode> getCaseSchemaDefinition(final ChoiceNode schema, final Class<?> childClass) throws IllegalArgumentException {
+ public Optional<ChoiceCaseNode> getCaseSchemaDefinition(final ChoiceSchemaNode schema, final Class<?> childClass) throws IllegalArgumentException {
final DataSchemaNode origSchema = getSchemaDefinition(childClass);
Preconditions.checkArgument(origSchema instanceof ChoiceCaseNode, "Supplied schema %s is not case.", origSchema);
public ImmutableMap<Type, Entry<Type, Type>> getChoiceCaseChildren(final DataNodeContainer schema) {
final Map<Type,Entry<Type,Type>> childToCase = new HashMap<>();;
- for (final ChoiceNode choice : FluentIterable.from(schema.getChildNodes()).filter(ChoiceNode.class)) {
- final ChoiceNode originalChoice = getOriginalSchema(choice);
+ for (final ChoiceSchemaNode choice : FluentIterable.from(schema.getChildNodes()).filter(ChoiceSchemaNode.class)) {
+ final ChoiceSchemaNode originalChoice = getOriginalSchema(choice);
final Type choiceType = referencedType(typeToDefiningSchema.inverse().get(originalChoice));
final Collection<Type> cases = choiceToCases.get(choiceType);
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
-
import com.google.common.base.Preconditions;
import java.net.URI;
import java.util.Date;
import javax.annotation.Nullable;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
final DataSchemaNode child = currentNode.getDataChildByName(currentArg);
if(child instanceof DataNodeContainer) {
currentNode = (DataNodeContainer) child;
- } else if (child instanceof ChoiceNode) {
+ } else if (child instanceof ChoiceSchemaNode) {
final QName caseQName = arguments.next();
Preconditions.checkArgument(arguments.hasNext(), "Path must not refer case only.");
- currentNode = ((ChoiceNode) child).getCaseNodeByName(caseQName);
+ currentNode = ((ChoiceSchemaNode) child).getCaseNodeByName(caseQName);
} else {
// Search in grouping
for( final GroupingDefinition grouping : currentNode.getGroupings()) {
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
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.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
for (DataSchemaNode childNode : container.getChildNodes()) {
if (childNode instanceof DataNodeContainer) {
ret.addAll(getAllUsesNodes((DataNodeContainer) childNode));
- } else if (childNode instanceof ChoiceNode) {
- Set<ChoiceCaseNode> cases = ((ChoiceNode) childNode).getCases();
+ } else if (childNode instanceof ChoiceSchemaNode) {
+ Set<ChoiceCaseNode> cases = ((ChoiceSchemaNode) childNode).getCases();
for (ChoiceCaseNode choiceCaseNode : cases) {
ret.addAll(getAllUsesNodes(choiceCaseNode));
}
import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode
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
«IF child instanceof ListSchemaNode»
«printListNode(child)»
«ENDIF»
- «IF child instanceof ChoiceNode»
+ «IF child instanceof ChoiceSchemaNode»
«printChoiceNode(child)»
«ENDIF»
'''
}
- private def printChoiceNode(ChoiceNode child) {
+ private def printChoiceNode(ChoiceSchemaNode child) {
val List<ChoiceCaseNode> cases = new ArrayList(child.cases);
if(!cases.empty) {
val ChoiceCaseNode aCase = cases.get(0)
«module.childNodes.treeSet(YangInstanceIdentifier.builder.build())»
'''
- private def dispatch CharSequence tree(ChoiceNode node,YangInstanceIdentifier path) '''
+ private def dispatch CharSequence tree(ChoiceSchemaNode node,YangInstanceIdentifier path) '''
«node.nodeName» (choice)
«casesTree(node.cases,path)»
'''
«ENDFOR»
</ul>
'''
- } else if(node instanceof ChoiceNode) {
+ } else if(node instanceof ChoiceSchemaNode) {
return '''
«printInfo(node, "choice")»
«listItem("default case", node.defaultCase)»
val anyxmlNodes = nodes.filter(AnyXmlSchemaNode)
val leafNodes = nodes.filter(LeafSchemaNode)
val leafListNodes = nodes.filter(LeafListSchemaNode)
- val choices = nodes.filter(ChoiceNode)
+ val choices = nodes.filter(ChoiceSchemaNode)
val cases = nodes.filter(ChoiceCaseNode)
val containers = nodes.filter(ContainerSchemaNode)
val lists = nodes.filter(ListSchemaNode)
«node.childNodes.printChildren(level,newPath)»
'''
- private def dispatch CharSequence printInfo(ChoiceNode node, int level, YangInstanceIdentifier path) '''
+ private def dispatch CharSequence printInfo(ChoiceSchemaNode node, int level, YangInstanceIdentifier path) '''
«val Set<DataSchemaNode> choiceCases = new HashSet(node.cases)»
«choiceCases.printChildren(level,path)»
'''
pathString.append(':')
pathString.append(name.localName)
pathString.append('/')
- if(node instanceof ChoiceNode && dataNode !== null) {
+ if(node instanceof ChoiceSchemaNode && dataNode !== null) {
val DataSchemaNode caseNode = dataNode.childNodes.findFirst[DataSchemaNode e | e instanceof ChoiceCaseNode];
if(caseNode !== null) {
pathString.append("(case)");
'''
private def String nodeSchemaPathToPath(DataSchemaNode node, Map<SchemaPath, DataSchemaNode> childNodes) {
- if (node instanceof ChoiceNode || node instanceof ChoiceCaseNode) {
+ if (node instanceof ChoiceSchemaNode || node instanceof ChoiceCaseNode) {
return null
}
for (pathElement : path) {
actual.add(pathElement)
val DataSchemaNode nodeByPath = childNodes.get(SchemaPath.create(actual, absolute))
- if (!(nodeByPath instanceof ChoiceNode) && !(nodeByPath instanceof ChoiceCaseNode)) {
+ if (!(nodeByPath instanceof ChoiceSchemaNode) && !(nodeByPath instanceof ChoiceCaseNode)) {
result.append(pathElement.localName)
if (i != path.size - 1) {
result.append("/")
if (node instanceof DataNodeContainer) {
collectChildNodes((node as DataNodeContainer).childNodes, destination)
}
- if (node instanceof ChoiceNode) {
+ if (node instanceof ChoiceSchemaNode) {
val List<DataSchemaNode> choiceCases = new ArrayList()
for (caseNode : node.cases) {
choiceCases.add(caseNode)