• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XSRestrictionSimpleType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.xml.internal.xsom.XSRestrictionSimpleType的典型用法代码示例。如果您正苦于以下问题:Java XSRestrictionSimpleType类的具体用法?Java XSRestrictionSimpleType怎么用?Java XSRestrictionSimpleType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XSRestrictionSimpleType类属于com.sun.xml.internal.xsom包,在下文中一共展示了XSRestrictionSimpleType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: restrictionSimpleType

import com.sun.xml.internal.xsom.XSRestrictionSimpleType; //导入依赖的package包/类
public void restrictionSimpleType(XSRestrictionSimpleType type) {

        if (type.getBaseType() == null) {
            // don't print anySimpleType
            if (!type.getName().equals("anySimpleType")) {
                throw new InternalError();
            }
            if (!Const.schemaNamespace.equals(type.getTargetNamespace())) {
                throw new InternalError();
            }
            return;
        }

        XSSimpleType baseType = type.getSimpleBaseType();

        String str = MessageFormat.format("Restriction {0}",
                new Object[]{baseType.isLocal() ? "" : " base=\"{"
                + baseType.getTargetNamespace() + "}"
                + baseType.getName() + "\""});

        SchemaTreeNode newNode = new SchemaTreeNode(str, baseType.getLocator());
        this.currNode.add(newNode);
        this.currNode = newNode;

        if (baseType.isLocal()) {
            simpleType(baseType);
        }

        Iterator itr = type.iterateDeclaredFacets();
        while (itr.hasNext()) {
            facet((XSFacet) itr.next());
        }

        this.currNode = (SchemaTreeNode) this.currNode.getParent();
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:SchemaTreeTraverser.java


示例2: restrictionSimpleType

import com.sun.xml.internal.xsom.XSRestrictionSimpleType; //导入依赖的package包/类
public void restrictionSimpleType( XSRestrictionSimpleType type ) {

        if(type.getBaseType()==null) {
            // don't print anySimpleType
            if(!type.getName().equals("anySimpleType"))
                throw new InternalError();
            if(!Const.schemaNamespace.equals(type.getTargetNamespace()))
                throw new InternalError();
            return;
        }

        XSSimpleType baseType = type.getSimpleBaseType();

        println(MessageFormat.format("<restriction{0}>",
            baseType.isLocal()?"":" base=\"{"+
            baseType.getTargetNamespace()+'}'+
            baseType.getName()+'\"'));
        indent++;

        if(baseType.isLocal())
            simpleType(baseType);

        Iterator itr = type.iterateDeclaredFacets();
        while(itr.hasNext())
            facet( (XSFacet)itr.next() );

        indent--;
        println("</restriction>");
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:SchemaWriter.java


示例3: simpleType

import com.sun.xml.internal.xsom.XSRestrictionSimpleType; //导入依赖的package包/类
public Iterator<XSFacet> simpleType(XSSimpleType type) {
    // TODO: it's not clear if "facets" mean all inherited facets or just declared facets
    XSRestrictionSimpleType r = type.asRestriction();
    if(r!=null)
        return r.iterateDeclaredFacets();
    else
        return empty();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:Axis.java


示例4: restrictionSimpleType

import com.sun.xml.internal.xsom.XSRestrictionSimpleType; //导入依赖的package包/类
public TypeUse restrictionSimpleType(XSRestrictionSimpleType type) {
    // just process the base type.
    return compose(type.getSimpleBaseType());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:SimpleTypeBuilder.java


示例5: shouldBeMappedToTypeSafeEnumByDefault

import com.sun.xml.internal.xsom.XSRestrictionSimpleType; //导入依赖的package包/类
/**
 * Returns true if a type-safe enum should be created from
 * the given simple type by default without an explicit &lt;jaxb:enum> customization.
 */
private boolean shouldBeMappedToTypeSafeEnumByDefault( XSRestrictionSimpleType type ) {

    // if not, there will be a problem wrt the class name of this type safe enum type.
    if( type.isLocal() )    return false;

    // if redefined, we should map the new definition, not the old one.
    if( type.getRedefinedBy()!=null )   return false;

    List<XSFacet> facets = type.getDeclaredFacets(XSFacet.FACET_ENUMERATION);
    if( facets.isEmpty() )
        // if the type itself doesn't have the enumeration facet,
        // it won't be mapped to a type-safe enum.
        return false;

    if(facets.size() > builder.getGlobalBinding().getDefaultEnumMemberSizeCap()) {
        // if there are too many facets, it's not very useful
        // produce warning when simple type is not mapped to enum
        // see issue https://jaxb.dev.java.net/issues/show_bug.cgi?id=711

        if(reportedEnumMemberSizeWarnings == null)
            reportedEnumMemberSizeWarnings = new HashSet<XSRestrictionSimpleType>();

        if(!reportedEnumMemberSizeWarnings.contains(type)) {
            getErrorReporter().warning(type.getLocator(), Messages.WARN_ENUM_MEMBER_SIZE_CAP,
                    type.getName(), facets.size(), builder.getGlobalBinding().getDefaultEnumMemberSizeCap());

            reportedEnumMemberSizeWarnings.add(type);
        }

        return false;
    }

    if( !canBeMappedToTypeSafeEnum(type) )
        // we simply can't map this to an enumeration
        return false;

    // check for collisions among constant names. if a collision will happen,
    // don't try to bind it to an enum.

    // return true only when this type is derived from one of the "enum base type".
    for( XSSimpleType t = type; t!=null; t=t.getSimpleBaseType() )
        if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) )
            return true;

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:SimpleTypeBuilder.java


示例6: buildCEnumConstants

import com.sun.xml.internal.xsom.XSRestrictionSimpleType; //导入依赖的package包/类
/**
 *
 * @param errorRef
 *      if constant names couldn't be generated, return a reference to that enum facet.
 * @return
 *      null if unable to generate names for some of the constants.
 */
private List<CEnumConstant> buildCEnumConstants(XSRestrictionSimpleType type, boolean needsToGenerateMemberName, Map<String, BIEnumMember> members, XSFacet[] errorRef) {
    List<CEnumConstant> memberList = new ArrayList<CEnumConstant>();
    int idx=1;
    Set<String> enums = new HashSet<String>(); // to avoid duplicates. See issue #366

    for( XSFacet facet : type.getDeclaredFacets(XSFacet.FACET_ENUMERATION)) {
        String name=null;
        String mdoc=builder.getBindInfo(facet).getDocumentation();

        if(!enums.add(facet.getValue().value))
            continue;   // ignore the 2nd occasion

        if( needsToGenerateMemberName ) {
            // generate names for all member names.
            // this will even override names specified by the user. that's crazy.
            name = "VALUE_"+(idx++);
        } else {
            String facetValue = facet.getValue().value;
            BIEnumMember mem = members.get(facetValue);
            if( mem==null )
                // look at the one attached to the facet object
                mem = builder.getBindInfo(facet).get(BIEnumMember.class);

            if (mem!=null) {
                name = mem.name;
                if (mdoc == null) {
                    mdoc = mem.javadoc;
                }
            }

            if(name==null) {
                StringBuilder sb = new StringBuilder();
                for( int i=0; i<facetValue.length(); i++) {
                    char ch = facetValue.charAt(i);
                    if(Character.isJavaIdentifierPart(ch))
                        sb.append(ch);
                    else
                        sb.append('_');
                }
                name = model.getNameConverter().toConstantName(sb.toString());
            }
        }

        if(!JJavaName.isJavaIdentifier(name)) {
            if(errorRef!=null)  errorRef[0] = facet;
            return null;    // unable to generate a name
        }

        memberList.add(new CEnumConstant(name,mdoc,facet.getValue().value,facet,builder.getBindInfo(facet).toCustomizationList(),facet.getLocator()));
    }
    return memberList;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:SimpleTypeBuilder.java


示例7: restrictionSimpleType

import com.sun.xml.internal.xsom.XSRestrictionSimpleType; //导入依赖的package包/类
public void restrictionSimpleType(XSRestrictionSimpleType type) {
    if(check(type))
        type.getBaseType().visit(this);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:UnusedCustomizationChecker.java


示例8: shouldBeMappedToTypeSafeEnumByDefault

import com.sun.xml.internal.xsom.XSRestrictionSimpleType; //导入依赖的package包/类
/**
 * Returns true if a type-safe enum should be created from
 * the given simple type by default without an explicit {@code <jaxb:enum>} customization.
 */
private boolean shouldBeMappedToTypeSafeEnumByDefault( XSRestrictionSimpleType type ) {

    // if not, there will be a problem wrt the class name of this type safe enum type.
    if( type.isLocal() )    return false;

    // if redefined, we should map the new definition, not the old one.
    if( type.getRedefinedBy()!=null )   return false;

    List<XSFacet> facets = type.getDeclaredFacets(XSFacet.FACET_ENUMERATION);
    if( facets.isEmpty() )
        // if the type itself doesn't have the enumeration facet,
        // it won't be mapped to a type-safe enum.
        return false;

    if(facets.size() > builder.getGlobalBinding().getDefaultEnumMemberSizeCap()) {
        // if there are too many facets, it's not very useful
        // produce warning when simple type is not mapped to enum
        // see issue https://jaxb.dev.java.net/issues/show_bug.cgi?id=711

        if(reportedEnumMemberSizeWarnings == null)
            reportedEnumMemberSizeWarnings = new HashSet<XSRestrictionSimpleType>();

        if(!reportedEnumMemberSizeWarnings.contains(type)) {
            getErrorReporter().warning(type.getLocator(), Messages.WARN_ENUM_MEMBER_SIZE_CAP,
                    type.getName(), facets.size(), builder.getGlobalBinding().getDefaultEnumMemberSizeCap());

            reportedEnumMemberSizeWarnings.add(type);
        }

        return false;
    }

    if( !canBeMappedToTypeSafeEnum(type) )
        // we simply can't map this to an enumeration
        return false;

    // check for collisions among constant names. if a collision will happen,
    // don't try to bind it to an enum.

    // return true only when this type is derived from one of the "enum base type".
    for( XSSimpleType t = type; t!=null; t=t.getSimpleBaseType() )
        if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) )
            return true;

    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:51,代码来源:SimpleTypeBuilder.java



注:本文中的com.sun.xml.internal.xsom.XSRestrictionSimpleType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java User类代码示例发布时间:2022-05-23
下一篇:
Java OnPauseEvent类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap