本文整理汇总了Java中com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition.VARIETY_UNION属性的典型用法代码示例。如果您正苦于以下问题:Java XSSimpleTypeDefinition.VARIETY_UNION属性的具体用法?Java XSSimpleTypeDefinition.VARIETY_UNION怎么用?Java XSSimpleTypeDefinition.VARIETY_UNION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition
的用法示例。
在下文中一共展示了XSSimpleTypeDefinition.VARIETY_UNION属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: typeDerivationOK
private boolean typeDerivationOK(XSTypeDefinition derived, XSTypeDefinition base, short blockingConstraint) {
short devMethod = 0, blockConstraint = blockingConstraint;
// "derived" should be derived from "base"
// add derivation methods of derived types to devMethod;
// add block of base types to blockConstraint.
XSTypeDefinition type = derived;
while (type != base && type != SchemaGrammar.fAnyType) {
if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
devMethod |= ((XSComplexTypeDecl)type).fDerivedBy;
}
else {
devMethod |= XSConstants.DERIVATION_RESTRICTION;
}
type = type.getBaseType();
// type == null means the current type is anySimpleType,
// whose base type should be anyType
if (type == null) {
type = SchemaGrammar.fAnyType;
}
if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
blockConstraint |= ((XSComplexTypeDecl)type).fBlock;
}
}
if (type != base) {
// If the base is a union, check if "derived" is allowed through any of the member types.
if (base.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) base;
if (st.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) {
XSObjectList memberTypes = st.getMemberTypes();
final int length = memberTypes.getLength();
for (int i = 0; i < length; ++i) {
if (typeDerivationOK(derived, (XSTypeDefinition) memberTypes.item(i), blockingConstraint)) {
return true;
}
}
}
}
return false;
}
if ((devMethod & blockConstraint) != 0) {
return false;
}
return true;
}