本文整理汇总了Java中com.sun.xml.xsom.XSType.getBaseType方法的典型用法代码示例。如果您正苦于以下问题:Java XSType.getBaseType方法的具体用法?Java XSType.getBaseType怎么用?Java XSType.getBaseType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.xsom.XSType
的用法示例。
在下文中一共展示了XSType.getBaseType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSubstitutable
import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
/**
* Implements
* <code>Validation Rule: Schema-Validity Assessment (Element) 1.2.1.2.4</code>
*/
private static boolean isSubstitutable( XSType _base, XSType derived ) {
// too ugly to the point that it's almost unbearable.
// I mean, it's not even transitive. Thus we end up calling this method
// for each candidate
if( _base.isComplexType() ) {
XSComplexType base = _base.asComplexType();
for( ; base!=derived; derived=derived.getBaseType() ) {
if( base.isSubstitutionProhibited( derived.getDerivationMethod() ) )
return false; // Type Derivation OK (Complex)-1
}
return true;
} else {
// simple type don't have any @block
return true;
}
}
示例2: hasAnnotation
import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
public static boolean hasAnnotation(XSType xsType, QName annotationElementName) {
if (xsType.getName() == null) {
return false;
}
Element annotationElement = getAnnotationElement(xsType.getAnnotation(), annotationElementName);
if (annotationElement != null) {
return true;
}
if (xsType.getBaseType() != null && !xsType.getBaseType().equals(xsType)) {
return hasAnnotation(xsType.getBaseType(), annotationElementName);
}
return false;
}
示例3: contains
import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
public boolean contains(XSType type) {
if( typeSet.contains(type) ) {
return true;
} else {
XSType baseType = type.getBaseType();
if( baseType == null ) {
return false;
} else {
// climb the super type hierarchy
return contains(baseType);
}
}
}
示例4: isDerivedFrom
import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
public boolean isDerivedFrom(XSType t) {
XSType x = this;
while(true) {
if(t==x)
return true;
XSType s = x.getBaseType();
if(s==x)
return false;
x = s;
}
}
示例5: listDirectSubstitutables
import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
private static XSType[] listDirectSubstitutables( XSType _this ) {
ArrayList r = new ArrayList();
// TODO: handle @block
Iterator itr = ((SchemaImpl)_this.getOwnerSchema()).parent.iterateTypes();
while( itr.hasNext() ) {
XSType t = (XSType)itr.next();
if( t.getBaseType()==_this )
r.add(t);
}
return (XSType[]) r.toArray(new XSType[r.size()]);
}
示例6: updateSubstitutabilityMap
import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
public void updateSubstitutabilityMap() {
ElementDecl parent = this;
XSType type = this.getType();
boolean rused = false;
boolean eused = false;
while( (parent=(ElementDecl)parent.getSubstAffiliation())!=null ) {
if(parent.isSubstitutionDisallowed(XSType.SUBSTITUTION))
continue;
boolean rd = parent.isSubstitutionDisallowed(XSType.RESTRICTION);
boolean ed = parent.isSubstitutionDisallowed(XSType.EXTENSION);
if( (rd && rused) || ( ed && eused ) ) continue;
XSType parentType = parent.getType();
while(type!=parentType) {
if(type.getDerivationMethod()==XSType.RESTRICTION) rused = true;
else eused = true;
type = type.getBaseType();
if(type==null) // parentType and type doesn't share the common base type. a bug in the schema.
break;
if( type.isComplexType() ) {
rd |= type.asComplexType().isSubstitutionProhibited(XSType.RESTRICTION);
ed |= type.asComplexType().isSubstitutionProhibited(XSType.EXTENSION);
}
}
if( (rd && rused) || ( ed && eused ) ) continue;
// this element can substitute "parent"
parent.addSubstitutable(this);
}
}