public ResolvedCustomFacets overwriteFacets(TypeDeclarationNode from) {
   final Map<String, CustomFacetDefinitionNode> facets = new HashMap<>(this.customFacets);
   final List<CustomFacetDefinitionNode> customFacets = from.getCustomFacets();
   for (CustomFacetDefinitionNode customFacet : customFacets) {
     facets.put(customFacet.getFacetName(), customFacet);
   }
   return new ResolvedCustomFacets(nativeFacets, facets);
 }
  /**
   * Checks if it can be inherited by the specified type
   *
   * @param from
   * @return
   */
  public TypeDeclarationNode validate(TypeDeclarationNode from) {

    final List<CustomFacetDefinitionNode> customFacets = from.getCustomFacets();
    for (CustomFacetDefinitionNode customFacet : customFacets) {
      if (nativeFacets.contains(customFacet.getFacetName())) {
        customFacet.replaceWith(
            RamlErrorNodeFactory.createCanNotOverrideNativeFacet(customFacet.getFacetName()));
      } else if (this.customFacets.containsKey(customFacet.getFacetName())) {
        final TypeDeclarationNode parentTypeDeclaration =
            customFacet.findAncestorWith(TypeDeclarationNode.class);
        final String typeName =
            parentTypeDeclaration != null ? parentTypeDeclaration.getTypeName() : "";
        customFacet.replaceWith(
            RamlErrorNodeFactory.createCanNotOverrideCustomFacet(
                customFacet.getFacetName(), typeName));
      }
    }
    return from;
  }