public static FacetValue getFacetValue(XSDSimpleTypeDefinition type, XSDConstrainingFacet facet) {
    FacetValue fv = new FacetValue();
    fv.description = ModelObjectUtilities.getDescription(facet);
    fv.type = type;
    fv.facet = facet;
    Object mainVal = getMainFacetValue(facet);
    if (mainVal != null) {
      fv.value = mainVal;
    } else {
      fv.value = getDefaultMainFacetValue(facet.getFacetName());
    } // endif

    if (type == facet.getContainer()) {
      // this facet set in the specified type, so it is not default:
      fv.defaultValue =
          null; // getMainFacetValue(type.getBaseTypeDefinition(), facet.getFacetName());
    } else {
      // facet set by a parent, so it is default:
      fv.defaultValue = fv.value;
    } // endif
    fv.isFixedLocal = isFixed(facet);

    return fv;
  }