+ private static AttributeIfc getReturnTypeAttribute(DataSchemaNode child, TypeProviderWrapper typeProviderWrapper,
+ String packageName) {
+ if (child instanceof LeafSchemaNode) {
+ LeafSchemaNode leaf = (LeafSchemaNode) child;
+ return new JavaAttribute(leaf, typeProviderWrapper);
+ } else if (child instanceof ContainerSchemaNode) {
+ ContainerSchemaNode container = (ContainerSchemaNode) child;
+ TOAttribute toAttribute = TOAttribute.create(container, typeProviderWrapper, packageName);
+ return toAttribute;
+ } else if (child instanceof ListSchemaNode) {
+ return ListAttribute.create((ListSchemaNode) child, typeProviderWrapper, packageName);
+ } else if (child instanceof LeafListSchemaNode) {
+ return ListAttribute.create((LeafListSchemaNode) child, typeProviderWrapper);
+ } else {
+ throw new IllegalStateException("Unknown output data node " + child + " for rpc");
+ }
+ }
+
+ private static Collection<DataSchemaNode> sortAttributes(Set<DataSchemaNode> childNodes) {
+ final TreeSet<DataSchemaNode> dataSchemaNodes = new TreeSet<>(new Comparator<DataSchemaNode>() {
+ @Override
+ public int compare(DataSchemaNode o1, DataSchemaNode o2) {
+ return o1.getQName().getLocalName().compareTo(o2.getQName().getLocalName());
+ }
+ });
+ dataSchemaNodes.addAll(childNodes);
+ return dataSchemaNodes;
+ }
+