/**
   * Reports featurereport into collection
   *
   * @param collection collection for feature report
   * @return FeatureTreeNode class which represents a root node of the constructed collection tree
   * @throws FeaturesTreeNodeException occurs when wrong features tree node constructs
   */
  @Override
  public FeatureTreeNode reportFeatures(FeaturesCollection collection)
      throws FeaturesTreeNodeException {
    if (shading != null) {
      FeatureTreeNode root = FeatureTreeNode.newRootInstance("shading");
      root.addAttribute(ID, id);

      parseParents(root);

      FeatureTreeNode.newChildInstanceWithValue(
          "shadingType", String.valueOf(shading.getShadingType()), root);

      if (colorSpaceChild != null) {
        FeatureTreeNode shadingClr = FeatureTreeNode.newChildInstance("colorSpace", root);
        shadingClr.addAttribute(ID, colorSpaceChild);
      }

      PBCreateNodeHelper.addBoxFeature("bbox", shading.getBBox(), root);

      FeatureTreeNode.newChildInstanceWithValue(
          "antiAlias", String.valueOf(shading.getAntiAlias()), root);

      collection.addNewFeatureTree(FeaturesObjectTypesEnum.SHADING, root);
      return root;
    }

    return null;
  }
  private void parseParents(FeatureTreeNode root) throws FeaturesTreeNodeException {
    if ((pageParent != null && !pageParent.isEmpty())
        || (patternParent != null && !patternParent.isEmpty())
        || (xobjectParent != null && !xobjectParent.isEmpty())
        || (fontParent != null && !fontParent.isEmpty())) {
      FeatureTreeNode parents = FeatureTreeNode.newChildInstance("parents", root);

      PBCreateNodeHelper.parseIDSet(pageParent, "page", null, parents);
      PBCreateNodeHelper.parseIDSet(patternParent, "pattern", null, parents);
      PBCreateNodeHelper.parseIDSet(xobjectParent, "xobject", null, parents);
      PBCreateNodeHelper.parseIDSet(fontParent, "font", null, parents);
    }
  }