private void emitBody(final StringBuilder b) {
   final Map<String, Type> getterToType =
       collectAllProperties(dtoType, new HashMap<String, Type>());
   for (final DataSchemaNode schemaChild : schemaNode.getChildNodes()) {
     if (!schemaChild.isAugmenting()) {
       final String getter = getGetterName(schemaChild);
       final Type childType = getterToType.get(getter);
       if (childType == null) {
         // FIXME AnyXml nodes are ignored, since their type cannot be found in generated bindnig
         // Bug-706 https://bugs.onos.org/show_bug.cgi?id=706
         if (schemaChild instanceof AnyXmlSchemaNode) {
           LOG.warn(
               "Node {} will be ignored. AnyXml is not yet supported from binding aware code."
                   + "Binding Independent code can be used to serialize anyXml nodes.",
               schemaChild.getPath());
           continue;
         } else {
           throw new IllegalStateException(
               String.format(
                   "Unable to find type for child node %s. Expected child nodes: %s",
                   schemaChild.getPath(), getterToType));
         }
       }
       emitChild(b, getter, childType, schemaChild);
     }
   }
 }
 private static DataNodeContainer augmentationProxy(
     final AugmentationSchema augmentation, final DataNodeContainer schema) {
   final Set<DataSchemaNode> children = new HashSet<>();
   for (final DataSchemaNode augNode : augmentation.getChildNodes()) {
     children.add(schema.getDataChildByName(augNode.getQName()));
   }
   return new EffectiveAugmentationSchema(augmentation, children);
 }
 private static AugmentationIdentifier augmentationIdentifierFrom(
     final AugmentationSchema augmentation) {
   final ImmutableSet.Builder<QName> potentialChildren = ImmutableSet.builder();
   for (final DataSchemaNode child : augmentation.getChildNodes()) {
     potentialChildren.add(child.getQName());
   }
   return new AugmentationIdentifier(potentialChildren.build());
 }
 private void emitChildInner(
     final StringBuilder b,
     final String getterName,
     final Type childType,
     final DataSchemaNode child) {
   if (child instanceof LeafSchemaNode) {
     b.append(statement(leafNode(child.getQName().getLocalName(), getterName)));
   } else if (child instanceof AnyXmlSchemaNode) {
     b.append(statement(anyxmlNode(child.getQName().getLocalName(), getterName)));
   } else if (child instanceof LeafListSchemaNode) {
     b.append(
         statement(startLeafSet(child.getQName().getLocalName(), invoke(getterName, "size"))));
     final Type valueType = ((ParameterizedType) childType).getActualTypeArguments()[0];
     b.append(forEach(getterName, valueType, statement(leafSetEntryNode(CURRENT))));
     b.append(statement(endNode()));
   } else if (child instanceof ListSchemaNode) {
     final Type valueType = ((ParameterizedType) childType).getActualTypeArguments()[0];
     final ListSchemaNode casted = (ListSchemaNode) child;
     emitList(b, getterName, valueType, casted);
   } else if (child instanceof ContainerSchemaNode) {
     b.append(
         tryToUseCacheElse(getterName, statement(staticInvokeEmitter(childType, getterName))));
   } else if (child instanceof ChoiceSchemaNode) {
     final String propertyName = CHOICE_PREFIX + childType.getName();
     staticConstant(
         propertyName,
         DataObjectSerializerImplementation.class,
         ChoiceDispatchSerializer.from(loadClass(childType)));
     b.append(
         tryToUseCacheElse(
             getterName,
             statement(
                 invoke(
                     propertyName,
                     StreamWriterGenerator.SERIALIZE_METHOD_NAME,
                     REGISTRY,
                     cast(DataObject.class.getName(), getterName),
                     STREAM))));
   }
 }
  private static final String getGetterName(final DataSchemaNode node) {
    final TypeDefinition<?> type;
    if (node instanceof LeafSchemaNode) {
      type = ((LeafSchemaNode) node).getType();
    } else if (node instanceof LeafListSchemaNode) {
      type = ((LeafListSchemaNode) node).getType();
    } else {
      type = null;
    }
    String prefix = "get";
    if (type != null) {
      TypeDefinition<?> rootType = type;
      while (rootType.getBaseType() != null) {
        rootType = rootType.getBaseType();
      }
      if (rootType instanceof BooleanTypeDefinition || rootType instanceof EmptyTypeDefinition) {
        prefix = "is";
      }
    }

    return prefix + BindingMapping.getClassName(node.getQName().getLocalName());
  }