public static String getFacetName(XSDConstrainingFacet facet) { String facetName = facet.getFacetName(); if (FACET_MAX_INCLUSIVE.equals(facetName) || FACET_MAX_EXCLUSIVE.equals(facetName)) { facetName = FAKE_FACET_MAXIMUM; } else if (FACET_MIN_INCLUSIVE.equals(facetName) || FACET_MIN_EXCLUSIVE.equals(facetName)) { facetName = FAKE_FACET_MINIMUM; } // endif return facetName; }
private static void removeFacet(XSDSimpleTypeDefinition type, String facetName) { // resolve the name, in case it is one of the bounds facets: String nameEx = getRealFacetName(facetName, false); String nameIn = getRealFacetName(facetName, true); // most of the time, name == name2 Iterator itor = type.getFacetContents().iterator(); while (itor.hasNext()) { XSDConstrainingFacet facet = (XSDConstrainingFacet) itor.next(); String thisName = facet.getFacetName(); if (nameEx.equals(thisName) || nameIn.equals(thisName)) { itor.remove(); } // endif } // endwhile }
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; }