@Deprecated @Override public boolean isAddedByUses() { return caseShorthandNode.isAddedByUses(); }
public static Set<AugmentationSchemaNode> collectAllAugmentationDefinitions(final SchemaContext currentSchema, final AugmentationTarget ctxNode) { HashSet<AugmentationSchemaNode> augmentations = new HashSet<>(); augmentations.addAll(ctxNode.getAvailableAugmentations()); if (ctxNode instanceof DataSchemaNode && ((DataSchemaNode) ctxNode).isAddedByUses()) { LOG.info("DataSchemaNode target added by uses {}", ctxNode); } return augmentations; }
public static Set<AugmentationSchema> collectAllAugmentationDefinitions(final SchemaContext currentSchema, final AugmentationTarget ctxNode) { HashSet<AugmentationSchema> augmentations = new HashSet<>(); augmentations.addAll(ctxNode.getAvailableAugmentations()); if(ctxNode instanceof DataSchemaNode && ((DataSchemaNode) ctxNode).isAddedByUses()) { System.out.println(ctxNode); } // TODO Auto-generated method stub return augmentations; }
private static int getChildNodeSizeWithoutUses(final DataNodeContainer csn) { int result = 0; for (DataSchemaNode dsn : csn.getChildNodes()) { if (dsn.isAddedByUses() == false) { result++; } } return result; }
@Override @SuppressWarnings({ "unchecked", "rawtypes" }) Item<?> createBindingArg(final Class<?> childClass, final DataSchemaNode childSchema) { return childSchema.isAddedByUses() ? Item.of((Class)getBindingClass(), (Class)childClass) : Item.of((Class<? extends DataObject>) childClass); }
private static Optional<DataNodeContainer> findDataNodeContainer(final DataNodeContainer ctx, final QName targetQName) { for (final DataSchemaNode child : ctx.getChildNodes()) { if (child instanceof ChoiceSchemaNode) { final DataNodeContainer potential = findInCases((ChoiceSchemaNode) child, targetQName); if (potential != null) { return Optional.of(potential); } } else if (child instanceof DataNodeContainer && child.getQName().equals(targetQName)) { return Optional.of((DataNodeContainer) child); } else if (child instanceof DataNodeContainer // && child.isAddedByUses() // && child.getQName().getLocalName().equals(targetQName.getLocalName())) { return Optional.of((DataNodeContainer) child); } } return Optional.empty(); }
private static Optional<DataNodeContainer> findDataNodeContainer(final DataNodeContainer ctx, final QName targetQName) { for (DataSchemaNode child : ctx.getChildNodes()) { if (child instanceof ChoiceSchemaNode) { DataNodeContainer potential = findInCases(((ChoiceSchemaNode) child), targetQName); if (potential != null) { return Optional.of(potential); } } else if (child instanceof DataNodeContainer && child.getQName().equals(targetQName)) { return Optional.of((DataNodeContainer) child); } else if (child instanceof DataNodeContainer // && child.isAddedByUses() // && child.getQName().getLocalName().equals(targetQName.getLocalName())) { return Optional.of((DataNodeContainer) child); } } return Optional.absent(); }
if (schemaNodes != null && parent != null) { for (final DataSchemaNode schemaNode : schemaNodes) { if (!schemaNode.isAugmenting() && !schemaNode.isAddedByUses()) { addSchemaNodeToBuilderAsMethod(basePackageName, schemaNode, parent, childOf, module);
private static Optional<DataNodeContainer> findDataNodeContainer(final DataNodeContainer ctx, final QName targetQName) { for (DataSchemaNode child : ctx.getChildNodes()) { if (child instanceof ChoiceSchemaNode) { DataNodeContainer potential = findInCases((ChoiceSchemaNode) child, targetQName); if (potential != null) { return Optional.of(potential); } } else if (child instanceof DataNodeContainer && child.getQName().equals(targetQName)) { return Optional.of((DataNodeContainer) child); } else if (child instanceof DataNodeContainer // && child.isAddedByUses() // && child.getQName().getLocalName().equals(targetQName.getLocalName())) { return Optional.of((DataNodeContainer) child); } } return Optional.empty(); }
/** * Adds the methods to <code>typeBuilder</code> which represent subnodes of node for which <code>typeBuilder</code> * was created. The subnodes aren't mapped to the methods if they are part of grouping or augment (in this case are * already part of them). * * @param module current module * @param parent generated type builder which represents any node. The subnodes of this node are added * to the <code>typeBuilder</code> as methods. The subnode can be of type leaf, leaf-list, list, * container, choice. * @param childOf parent type * @param schemaNodes set of data schema nodes which are the children of the node for which * <code>typeBuilder</code> was created * @return generated type builder which is the same builder as input parameter. The getter methods (representing * child nodes) could be added to it. */ private GeneratedTypeBuilder resolveDataSchemaNodes(final ModuleContext context, final GeneratedTypeBuilder parent, final @Nullable Type childOf, final Iterable<DataSchemaNode> schemaNodes) { if (schemaNodes != null && parent != null) { final Type baseInterface = childOf == null ? DATA_OBJECT : childOf(childOf); for (final DataSchemaNode schemaNode : schemaNodes) { if (!schemaNode.isAugmenting() && !schemaNode.isAddedByUses()) { addSchemaNodeToBuilderAsMethod(context, schemaNode, parent, baseInterface); } } } return parent; }
private void emitDataSchemaNode(final DataSchemaNode child) { if (!super.emitInstantiated && (child.isAddedByUses() || child.isAugmenting())) { // We skip instantiated nodes. return; } if (child instanceof ContainerSchemaNode) { emitContainer((ContainerSchemaNode) child); } else if (child instanceof LeafSchemaNode) { emitLeaf((LeafSchemaNode) child); } else if (child instanceof LeafListSchemaNode) { emitLeafList((LeafListSchemaNode) child); } else if (child instanceof ListSchemaNode) { emitList((ListSchemaNode) child); } else if (child instanceof ChoiceSchemaNode) { emitChoice((ChoiceSchemaNode) child); } else if (child instanceof AnyXmlSchemaNode) { emitAnyxml((AnyXmlSchemaNode) child); } else if (child instanceof AnyDataSchemaNode) { emitAnydata((AnyDataSchemaNode) child); } else { throw new UnsupportedOperationException("Not supported DataSchemaNode type " + child.getClass()); } }
if (resultDataSchemaNode.isAddedByUses()) {
if (resultDataSchemaNode.isAddedByUses()) {
} else if (!schemaNode.isAddedByUses()) { if (schemaNode instanceof LeafListSchemaNode) { resolveLeafListSchemaNode(typeBuilder, (LeafListSchemaNode) schemaNode, module);
if (targetSchemaNode instanceof DataSchemaNode && ((DataSchemaNode) targetSchemaNode).isAddedByUses()) { if (targetSchemaNode instanceof DerivableSchemaNode) { targetSchemaNode = ((DerivableSchemaNode) targetSchemaNode).getOriginal().orNull();
if (targetSchemaNode instanceof DataSchemaNode && ((DataSchemaNode) targetSchemaNode).isAddedByUses()) { if (targetSchemaNode instanceof DerivableSchemaNode) { targetSchemaNode = ((DerivableSchemaNode) targetSchemaNode).getOriginal().orElse(null);
} else if (!schemaNode.isAddedByUses()) { if (schemaNode instanceof LeafListSchemaNode) { resolveLeafListSchemaNode(typeBuilder, (LeafListSchemaNode) schemaNode, context);
SchemaNode targetSchemaNode = findDataSchemaNode(schemaContext, targetPath); if (targetSchemaNode instanceof DataSchemaNode && ((DataSchemaNode) targetSchemaNode).isAddedByUses()) { if (targetSchemaNode instanceof DerivableSchemaNode) { targetSchemaNode = ((DerivableSchemaNode) targetSchemaNode).getOriginal().orNull();
private GeneratedTypeBuilder processDataSchemaNode(final ModuleContext context, final Type baseInterface, final DataSchemaNode node) { if (node.isAugmenting() || node.isAddedByUses()) { return null; } final GeneratedTypeBuilder genType = addDefaultInterfaceDefinition(context, node, baseInterface); annotateDeprecatedIfNecessary(node.getStatus(), genType); final Module module = context.module(); genType.setModuleName(module.getName()); addCodegenInformation(genType, module, node); genType.setSchemaPath(node.getPath()); if (node instanceof DataNodeContainer) { context.addChildNodeType(node, genType); groupingsToGenTypes(context, ((DataNodeContainer) node).getGroupings()); processUsesAugments((DataNodeContainer) node, context); } return genType; }
private GeneratedTypeBuilder processDataSchemaNode(final Module module, final String basePackageName, final GeneratedTypeBuilder childOf, final DataSchemaNode node) { if (node.isAugmenting() || node.isAddedByUses()) { return null; } final String packageName = packageNameForGeneratedType(basePackageName, node.getPath()); final GeneratedTypeBuilder genType = addDefaultInterfaceDefinition(packageName, node, childOf, module); genType.addComment(node.getDescription()); genType.setDescription(createDescription(node, genType.getFullyQualifiedName())); genType.setModuleName(module.getName()); genType.setReference(node.getReference()); genType.setSchemaPath(node.getPath().getPathFromRoot()); if (node instanceof DataNodeContainer) { genCtx.get(module).addChildNodeType(node, genType); groupingsToGenTypes(module, ((DataNodeContainer) node).getGroupings()); processUsesAugments((DataNodeContainer) node, module); } return genType; }