当前位置: 首页>>代码示例>>Java>>正文


Java XSParticle类代码示例

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


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

示例1: isApplicable

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
public boolean isApplicable(XSComplexType ct) {
    if( !bgmBuilder.getGlobalBinding().isChoiceContentPropertyEnabled() )
        return false;

    if( ct.getBaseType()!=schemas.getAnyType() )
        // My reading of the spec is that if a complex type is
        // derived from another complex type by extension,
        // its top level model group is always a sequence
        // that combines the base type content model and
        // the extension defined in the new complex type.
        return false;

    XSParticle p = ct.getContentType().asParticle();
    if(p==null)
        return false;

    XSModelGroup mg = getTopLevelModelGroup(p);

    if( mg.getCompositor()!=XSModelGroup.CHOICE )
        return false;

    if( p.isRepeated() )
        return false;

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

示例2: containingChoice

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
private boolean containingChoice(CClassInfo typeBean) {
    XSComponent component = typeBean.getSchemaComponent();
    if (component instanceof XSComplexType) {
        XSContentType contentType = ((XSComplexType) component).getContentType();
        XSParticle particle = contentType.asParticle();
        if (particle != null) {
            XSTerm term = particle.getTerm();
            XSModelGroup modelGroup = term.asModelGroup();
            if (modelGroup != null) {
                return (modelGroup.getCompositor() == XSModelGroup.Compositor.CHOICE);
            }
        }
    }

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

示例3: getLocalDomCustomization

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
/**
 * Gets the {@link BIDom} object that applies to the given particle.
 */
protected final BIDom getLocalDomCustomization( XSParticle p ) {
    if (p == null) {
        return null;
    }
    BIDom dom = getBindInfo(p).get(BIDom.class);
    if(dom!=null)  return dom;

    // if not, the term might have one.
    dom = getBindInfo(p.getTerm()).get(BIDom.class);
    if(dom!=null)  return dom;

    XSTerm t = p.getTerm();
    // type could also have one, in case of the dom customization
    if(t.isElementDecl())
        return getBindInfo(t.asElementDecl().getType()).get(BIDom.class);
    // similarly the model group in a model group definition may have one.
    if(t.isModelGroupDecl())
        return getBindInfo(t.asModelGroupDecl().getModelGroup()).get(BIDom.class);

    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:BGMBuilder.java

示例4: getCustomizations

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
private CCustomizations getCustomizations( XSParticle src ) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if(src.getTerm().isElementDecl()) {
        XSElementDecl xed = src.getTerm().asElementDecl();
        if(xed.isGlobal())
            return getCustomizations((XSComponent)src);
    }

    return getCustomizations(src,src.getTerm());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:BIProperty.java

示例5: findSourceParticle

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
/**
 * Finds a {@link XSParticle} that can serve as the representative property of
 * the given {@link ConnectedComponent}.
 *
 * The representative property is used for reporting an error location and
 * taking {@link BIProperty} customization. Right now, the algorithm is just pick
 * the first one with {@link BIProperty}, but one can think of a better algorithm,
 * such as taking a choice of (A|B) if CC={A,B}.
 */
private XSParticle findSourceParticle(ConnectedComponent cc) {
    XSParticle first = null;

    for (Element e : cc) {
        GElement ge = (GElement)e;
        for (XSParticle p : ge.particles) {
            if(first==null)
                first = p;
            if(getLocalPropCustomization(p)!=null)
                return p;
        }
        // if there are multiple property customizations,
        // all but one will be left unused, which will be detected as an error
        // later, so no need to check that now.
    }

    // if no customization was found, just use the first one.
    return first;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:ExpressionParticleBinder.java

示例6: build

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
@Override
public void build( XSParticle p, Collection<XSParticle> forcedProps ) {
    Checker checker = checkCollision(p,forcedProps);

    if(checker.hasNameCollision()) {
        CReferencePropertyInfo prop = new CReferencePropertyInfo(
            getCurrentBean().getBaseClass()==null?"Content":"Rest",
            true, false, false, p,
            builder.getBindInfo(p).toCustomizationList(),
            p.getLocator(), false, false, false);
        RawTypeSetBuilder.build(p,false).addTo(prop);
        prop.javadoc = Messages.format( Messages.MSG_FALLBACK_JAVADOC,
                checker.getCollisionInfo().toString() );

        getCurrentBean().addProperty(prop);
    } else {
        new Builder(checker.markedParticles).particle(p);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:DefaultParticleBinder.java

示例7: check

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
/**
             * Checks the label conflict of a particle.
             * This method shall be called for each marked particle.
             *
             * @return
             *      a description of a collision if a name collision is
             *      found. Otherwise null.
             */
            CollisionInfo check( XSParticle p ) {
                // this can be used for particles with a property customization,
                // which may not have element declaration as its term.
//                // we only check particles with element declarations.
//                _assert( p.getTerm().isElementDecl() );

                String label = computeLabel(p);
                if( occupiedLabels.containsKey(label) ) {
                    // collide with occupied labels
                    return new CollisionInfo(label,p.getLocator(),
                            occupiedLabels.get(label).locator);
                }

                for( XSParticle jp : particles ) {
                    if(!check( p, jp )) {
                        // problem was found. no need to check further
                        return new CollisionInfo( label, p.getLocator(), jp.getLocator() );
                    }
                }
                particles.add(p);
                return null;
            }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:DefaultParticleBinder.java

示例8: particle

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
public void particle( XSParticle p ) {
    XSTerm t = p.getTerm();

    if(marked(p)) {
        BIProperty cust = BIProperty.getCustomization(p);
        CPropertyInfo prop = cust.createElementOrReferenceProperty(
            getLabel(p), false, p, RawTypeSetBuilder.build(p,insideOptionalParticle));
        getCurrentBean().addProperty(prop);
    } else {
        // repeated model groups should have been marked already
        assert !p.isRepeated();

        boolean oldIOP = insideOptionalParticle;
        insideOptionalParticle |= BigInteger.ZERO.equals(p.getMinOccurs());
        // this is an unmarked particle
        t.visit(this);
        insideOptionalParticle = oldIOP;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:DefaultParticleBinder.java

示例9: isApplicable

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
public boolean isApplicable(XSComplexType ct) {
    if (!bgmBuilder.model.options.contentForWildcard) {
        return false;
    }
    XSType bt = ct.getBaseType();
    if (bt ==schemas.getAnyType() && ct.getContentType() != null) {
        XSParticle part = ct.getContentType().asParticle();
        if ((part != null) && (part.getTerm().isModelGroup())) {
            XSParticle[] parts = part.getTerm().asModelGroup().getChildren();
            int wildcardCount = 0;
            int i = 0;
            while ((i < parts.length) && (wildcardCount <= 1)) {
                if (parts[i].getTerm().isWildcard()) {
                    wildcardCount += 1;
                }
                i++;
            }
            return (wildcardCount > 1);
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:MultiWildcardComplexTypeBuilder.java

示例10: modelGroup

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
public Multiplicity modelGroup(XSModelGroup group) {
    boolean isChoice = group.getCompositor() == XSModelGroup.CHOICE;

    Multiplicity r = ZERO;

    for( XSParticle p : group.getChildren()) {
        Multiplicity m = particle(p);

        if(r==null) {
            r=m;
            continue;
        }
        if(isChoice) {
            r = Multiplicity.choice(r,m);
        } else {
            r = Multiplicity.group(r,m);
        }
    }
    return r;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:MultiplicityCounter.java

示例11: complexType

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
public Iterator<T> complexType(XSComplexType type) {
    // compensate particle
    XSParticle p = type.getContentType().asParticle();
    if(p!=null)
        return particle(p);
    else
        return empty();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:AbstractAxisImpl.java

示例12: modelGroup

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
public Iterator<T> modelGroup(XSModelGroup group) {
    // compensate for particles that are ignored in SCD
    return new Iterators.Map<T,XSParticle>(group.iterator()) {
        protected Iterator<? extends T> apply(XSParticle p) {
            return particle(p);
        }
    };
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:AbstractAxisImpl.java

示例13: visit

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
private void visit(XSModelGroup mg, List<XSComponent> r) {
    // since model groups never form a cycle, no cycle check is needed
    r.add(mg);
    for (XSParticle p : mg) {
        XSModelGroup child = p.getTerm().asModelGroup();
        if(child!=null)
            visit(child,r);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:Axis.java

示例14: createElementProperty

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
/**
 *
 *
 * @param defaultName
 *      If the name is not customized, this name will be used
 *      as the default. Note that the name conversion <b>MUST</b>
 *      be applied before this method is called if necessary.
 * @param source
 *      Source schema component from which a field is built.
 */
public CElementPropertyInfo createElementProperty(String defaultName, boolean forConstant, XSParticle source,
                                                  RawTypeSet types) {

    if(!types.refs.isEmpty())
        // if this property is empty, don't acknowleedge the customization
        // this allows pointless property customization to be reported as an error
        markAsAcknowledged();
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if(name==null)
        name = defaultName;

    CElementPropertyInfo prop = wrapUp(
        new CElementPropertyInfo(
            name, types.getCollectionMode(),
            types.id(),
            types.getExpectedMimeType(),
            source, getCustomizations(source),
            source.getLocator(), types.isRequired()),
        source);

    types.addTo(prop);

    BIInlineBinaryData.handle(source.getTerm(), prop);
    return prop;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:BIProperty.java

示例15: createElementOrReferenceProperty

import com.sun.xml.internal.xsom.XSParticle; //导入依赖的package包/类
public CPropertyInfo createElementOrReferenceProperty(
        String defaultName, boolean forConstant, XSParticle source,
        RawTypeSet types) {

    boolean generateRef;

    switch(types.canBeTypeRefs) {
    case CAN_BE_TYPEREF:
    case SHOULD_BE_TYPEREF:
        // it's up to the use
        Boolean b = generateElementProperty();
        if(b==null) // follow XJC recommendation
            generateRef = types.canBeTypeRefs== RawTypeSet.Mode.CAN_BE_TYPEREF;
        else // use the value user gave us
            generateRef = b;
        break;
    case MUST_BE_REFERENCE:
        generateRef = true;
        break;
    default:
        throw new AssertionError();
    }

    if(generateRef) {
        return createReferenceProperty(defaultName,forConstant,source,types, false, false, false, false);
    } else {
        return createElementProperty(defaultName,forConstant,source,types);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:BIProperty.java


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