{
Metaclass parent = m_metadata.getMetaclass(sParentEnumeration);
if (!((Set)m_enumerationValueMap.get(sParentEnumeration)).contains(parent.getAttribute("value").getType().convert(sParentValue)))
{
throw new MetadataLookupException("err.meta.enumParentValueLookup", sParentValue, sParentEnumeration);
}
}
});
}
else
{
if (sParentEnumeration != null)
{
throw new MetadataException("err.meta.enumNoParentValue", new Object[]{sValue, sEnumerationName});
}
}
if (m_bValidatedOnly)
{
XMLUtil.withFirstChildElement(valueElement, "Locales", false, new ElementHandler()
{
public void handleElement(Element localesElement)
{
final Set localeSet = new HashHolder();
XMLUtil.forEachChildElement(localesElement, "Locale",
m_helper.new ElementHandler("locale")
{
public void handleElement(Element localeElement, String sLocale)
{
if (!localeSet.add(sLocale))
{
throw new MetadataException("err.meta.enumValueLocaleDup",
new Object[]{sLocale, sValue, sEnumerationName});
}
XMLUtil.getReqStringAttr(localeElement, "caption");
}
});
}
});
}
}
});
if (behaveAsSet.size() != 0)
{
// Remove the values that have no behavior
for (int i = 0, n = fixupList.size(); i != n; i += 3)
{
if (!((Boolean)fixupList.get(i + 2)).booleanValue())
{
valueSet.remove(fixupList.get(i + 1));
}
}
for (Iterator itr = behaveAsSet.iterator(); itr.hasNext();)
{
String sValue = (String)itr.next();
if (!valueSet.contains(sValue))
{
throw new MetadataLookupException("err.meta.enumBehaveAsValueLookup",
sValue, sEnumerationName);
}
}
}