com.sun.tools.internal.xjc.model.CTypeInfo Java Examples

The following examples show how to use com.sun.tools.internal.xjc.model.CTypeInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ElementMappingImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public final List<Property> calcDrilldown() {
    CElementPropertyInfo p = clazz.getProperty();

    if(p.getAdapter()!=null)
        return null;    // if adapted, avoid drill down

    if(p.isCollection())
    // things like <xs:element name="foo" type="xs:NMTOKENS" /> is not eligible.
        return null;

    CTypeInfo typeClass = p.ref().get(0);

    if(!(typeClass instanceof CClassInfo))
        // things like <xs:element name="foo" type="xs:string" /> is not eligible.
        return null;

    CClassInfo ci = (CClassInfo)typeClass;

    // if the type is abstract we can't use it.
    if(ci.isAbstract())
        return null;

    // the 'all' compositor doesn't qualify
    if(!ci.isOrdered())
        return null;

    return buildDrilldown(ci);
}
 
Example #2
Source File: ElementMappingImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public final List<Property> calcDrilldown() {
    CElementPropertyInfo p = clazz.getProperty();

    if(p.getAdapter()!=null)
        return null;    // if adapted, avoid drill down

    if(p.isCollection())
    // things like <xs:element name="foo" type="xs:NMTOKENS" /> is not eligible.
        return null;

    CTypeInfo typeClass = p.ref().get(0);

    if(!(typeClass instanceof CClassInfo))
        // things like <xs:element name="foo" type="xs:string" /> is not eligible.
        return null;

    CClassInfo ci = (CClassInfo)typeClass;

    // if the type is abstract we can't use it.
    if(ci.isAbstract())
        return null;

    // the 'all' compositor doesn't qualify
    if(!ci.isOrdered())
        return null;

    return buildDrilldown(ci);
}
 
Example #3
Source File: AbstractField.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns contents to be added to javadoc.
 */
protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
    List<Object> r = new ArrayList<Object>();
    for( CTypeInfo tt : prop.ref() ) {
        JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
        if( t.isPrimitive() || t.isArray() )
            r.add(t.fullName());
        else {
            r.add(t);
            r.add("\n");
        }
    }

    return r;
}
 
Example #4
Source File: ElementMappingImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public final List<Property> calcDrilldown() {
    CElementPropertyInfo p = clazz.getProperty();

    if(p.getAdapter()!=null)
        return null;    // if adapted, avoid drill down

    if(p.isCollection())
    // things like <xs:element name="foo" type="xs:NMTOKENS" /> is not eligible.
        return null;

    CTypeInfo typeClass = p.ref().get(0);

    if(!(typeClass instanceof CClassInfo))
        // things like <xs:element name="foo" type="xs:string" /> is not eligible.
        return null;

    CClassInfo ci = (CClassInfo)typeClass;

    // if the type is abstract we can't use it.
    if(ci.isAbstract())
        return null;

    // the 'all' compositor doesn't qualify
    if(!ci.isOrdered())
        return null;

    return buildDrilldown(ci);
}
 
Example #5
Source File: AbstractField.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns contents to be added to javadoc.
 */
protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
    List<Object> r = new ArrayList<Object>();
    for( CTypeInfo tt : prop.ref() ) {
        JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
        if( t.isPrimitive() || t.isArray() )
            r.add(t.fullName());
        else {
            r.add(t);
            r.add("\n");
        }
    }

    return r;
}
 
Example #6
Source File: ElementMappingImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public final List<Property> calcDrilldown() {
    CElementPropertyInfo p = clazz.getProperty();

    if(p.getAdapter()!=null)
        return null;    // if adapted, avoid drill down

    if(p.isCollection())
    // things like <xs:element name="foo" type="xs:NMTOKENS" /> is not eligible.
        return null;

    CTypeInfo typeClass = p.ref().get(0);

    if(!(typeClass instanceof CClassInfo))
        // things like <xs:element name="foo" type="xs:string" /> is not eligible.
        return null;

    CClassInfo ci = (CClassInfo)typeClass;

    // if the type is abstract we can't use it.
    if(ci.isAbstract())
        return null;

    // the 'all' compositor doesn't qualify
    if(!ci.isOrdered())
        return null;

    return buildDrilldown(ci);
}
 
Example #7
Source File: AbstractField.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns contents to be added to javadoc.
 */
protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
    List<Object> r = new ArrayList<Object>();
    for( CTypeInfo tt : prop.ref() ) {
        JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
        if( t.isPrimitive() || t.isArray() )
            r.add(t.fullName());
        else {
            r.add(t);
            r.add("\n");
        }
    }

    return r;
}
 
Example #8
Source File: ElementMappingImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public final List<Property> calcDrilldown() {
    CElementPropertyInfo p = clazz.getProperty();

    if(p.getAdapter()!=null)
        return null;    // if adapted, avoid drill down

    if(p.isCollection())
    // things like <xs:element name="foo" type="xs:NMTOKENS" /> is not eligible.
        return null;

    CTypeInfo typeClass = p.ref().get(0);

    if(!(typeClass instanceof CClassInfo))
        // things like <xs:element name="foo" type="xs:string" /> is not eligible.
        return null;

    CClassInfo ci = (CClassInfo)typeClass;

    // if the type is abstract we can't use it.
    if(ci.isAbstract())
        return null;

    // the 'all' compositor doesn't qualify
    if(!ci.isOrdered())
        return null;

    return buildDrilldown(ci);
}
 
Example #9
Source File: AbstractField.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns contents to be added to javadoc.
 */
protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
    List<Object> r = new ArrayList<Object>();
    for( CTypeInfo tt : prop.ref() ) {
        JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
        if( t.isPrimitive() || t.isArray() )
            r.add(t.fullName());
        else {
            r.add(t);
            r.add("\n");
        }
    }

    return r;
}
 
Example #10
Source File: ElementMappingImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public final List<Property> calcDrilldown() {
    CElementPropertyInfo p = clazz.getProperty();

    if(p.getAdapter()!=null)
        return null;    // if adapted, avoid drill down

    if(p.isCollection())
    // things like <xs:element name="foo" type="xs:NMTOKENS" /> is not eligible.
        return null;

    CTypeInfo typeClass = p.ref().get(0);

    if(!(typeClass instanceof CClassInfo))
        // things like <xs:element name="foo" type="xs:string" /> is not eligible.
        return null;

    CClassInfo ci = (CClassInfo)typeClass;

    // if the type is abstract we can't use it.
    if(ci.isAbstract())
        return null;

    // the 'all' compositor doesn't qualify
    if(!ci.isOrdered())
        return null;

    return buildDrilldown(ci);
}
 
Example #11
Source File: AbstractField.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns contents to be added to javadoc.
 */
protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
    List<Object> r = new ArrayList<Object>();
    for( CTypeInfo tt : prop.ref() ) {
        JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
        if( t.isPrimitive() || t.isArray() )
            r.add(t.fullName());
        else {
            r.add(t);
            r.add("\n");
        }
    }

    return r;
}
 
Example #12
Source File: ElementMappingImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public final List<Property> calcDrilldown() {
    CElementPropertyInfo p = clazz.getProperty();

    if(p.getAdapter()!=null)
        return null;    // if adapted, avoid drill down

    if(p.isCollection())
    // things like <xs:element name="foo" type="xs:NMTOKENS" /> is not eligible.
        return null;

    CTypeInfo typeClass = p.ref().get(0);

    if(!(typeClass instanceof CClassInfo))
        // things like <xs:element name="foo" type="xs:string" /> is not eligible.
        return null;

    CClassInfo ci = (CClassInfo)typeClass;

    // if the type is abstract we can't use it.
    if(ci.isAbstract())
        return null;

    // the 'all' compositor doesn't qualify
    if(!ci.isOrdered())
        return null;

    return buildDrilldown(ci);
}
 
Example #13
Source File: AbstractField.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns contents to be added to javadoc.
 */
protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
    List<Object> r = new ArrayList<Object>();
    for( CTypeInfo tt : prop.ref() ) {
        JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
        if( t.isPrimitive() || t.isArray() )
            r.add(t.fullName());
        else {
            r.add(t);
            r.add("\n");
        }
    }

    return r;
}
 
Example #14
Source File: AbstractField.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns contents to be added to javadoc.
 */
protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
    List<Object> r = new ArrayList<Object>();
    for( CTypeInfo tt : prop.ref() ) {
        JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
        if( t.isPrimitive() || t.isArray() )
            r.add(t.fullName());
        else {
            r.add(t);
            r.add("\n");
        }
    }

    return r;
}
 
Example #15
Source File: AbstractField.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns contents to be added to javadoc.
 */
protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
    List<Object> r = new ArrayList<Object>();
    for( CTypeInfo tt : prop.ref() ) {
        JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
        if( t.isPrimitive() || t.isArray() )
            r.add(t.fullName());
        else {
            r.add(t);
            r.add("\n");
        }
    }

    return r;
}
 
Example #16
Source File: ElementMappingImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public final List<Property> calcDrilldown() {
    CElementPropertyInfo p = clazz.getProperty();

    if(p.getAdapter()!=null)
        return null;    // if adapted, avoid drill down

    if(p.isCollection())
    // things like <xs:element name="foo" type="xs:NMTOKENS" /> is not eligible.
        return null;

    CTypeInfo typeClass = p.ref().get(0);

    if(!(typeClass instanceof CClassInfo))
        // things like <xs:element name="foo" type="xs:string" /> is not eligible.
        return null;

    CClassInfo ci = (CClassInfo)typeClass;

    // if the type is abstract we can't use it.
    if(ci.isAbstract())
        return null;

    // the 'all' compositor doesn't qualify
    if(!ci.isOrdered())
        return null;

    return buildDrilldown(ci);
}
 
Example #17
Source File: ClassSelector.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The real meat of the "bindToType" code.
 *
 * @param cannotBeDelayed
 *      if the binding of the body of the class cannot be defered
 *      and needs to be done immediately. If the flag is false,
 *      the binding of the body will be done later, to avoid
 *      cyclic binding problem.
 * @param referer
 *      The component that refers to <tt>sc</tt>. This can be null,
 *      if figuring out the referer is too hard, in which case
 *      the error message might be less user friendly.
 */
// TODO: consider getting rid of "cannotBeDelayed"
CTypeInfo _bindToClass( @NotNull XSComponent sc, XSComponent referer, boolean cannotBeDelayed ) {
    // check if this class is already built.
    if(!bindMap.containsKey(sc)) {
        // craete a bind task

        // if this is a global declaration, make sure they will be generated
        // under a package.
        boolean isGlobal = false;
        if( sc instanceof XSDeclaration ) {
            isGlobal = ((XSDeclaration)sc).isGlobal();
            if( isGlobal )
                pushClassScope( new CClassInfoParent.Package(
                    getPackage(((XSDeclaration)sc).getTargetNamespace())) );
        }

        // otherwise check if this component should become a class.
        CElement bean = sc.apply(classBinder);

        if( isGlobal )
            popClassScope();

        if(bean==null)
            return null;

        // can this namespace generate a class?
        if (bean instanceof CClassInfo) {
            XSSchema os = sc.getOwnerSchema();
            BISchemaBinding sb = builder.getBindInfo(os).get(BISchemaBinding.class);
            if(sb!=null && !sb.map) {
                // nope
                getErrorReporter().error(sc.getLocator(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS, sc.apply( new ComponentNameFunction() ) );
                getErrorReporter().error(sb.getLocation(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_MAP_FALSE, os.getTargetNamespace() );
                if(referer!=null)
                    getErrorReporter().error(referer.getLocator(),
                        Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_REFERER, referer.apply( new ComponentNameFunction() ) );
            }
        }


        queueBuild( sc, bean );
    }

    Binding bind = bindMap.get(sc);
    if( cannotBeDelayed )
        bind.build();

    return bind.bean;
}
 
Example #18
Source File: ClassSelector.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public Binding(XSComponent sc, CTypeInfo bean) {
    this.sc = sc;
    this.bean = bean;
}
 
Example #19
Source File: ClassSelector.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public Binding(XSComponent sc, CTypeInfo bean) {
    this.sc = sc;
    this.bean = bean;
}
 
Example #20
Source File: ClassSelector.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The real meat of the "bindToType" code.
 *
 * @param cannotBeDelayed
 *      if the binding of the body of the class cannot be defered
 *      and needs to be done immediately. If the flag is false,
 *      the binding of the body will be done later, to avoid
 *      cyclic binding problem.
 * @param referer
 *      The component that refers to <tt>sc</tt>. This can be null,
 *      if figuring out the referer is too hard, in which case
 *      the error message might be less user friendly.
 */
// TODO: consider getting rid of "cannotBeDelayed"
CTypeInfo _bindToClass( @NotNull XSComponent sc, XSComponent referer, boolean cannotBeDelayed ) {
    // check if this class is already built.
    if(!bindMap.containsKey(sc)) {
        // craete a bind task

        // if this is a global declaration, make sure they will be generated
        // under a package.
        boolean isGlobal = false;
        if( sc instanceof XSDeclaration ) {
            isGlobal = ((XSDeclaration)sc).isGlobal();
            if( isGlobal )
                pushClassScope( new CClassInfoParent.Package(
                    getPackage(((XSDeclaration)sc).getTargetNamespace())) );
        }

        // otherwise check if this component should become a class.
        CElement bean = sc.apply(classBinder);

        if( isGlobal )
            popClassScope();

        if(bean==null)
            return null;

        // can this namespace generate a class?
        if (bean instanceof CClassInfo) {
            XSSchema os = sc.getOwnerSchema();
            BISchemaBinding sb = builder.getBindInfo(os).get(BISchemaBinding.class);
            if(sb!=null && !sb.map) {
                // nope
                getErrorReporter().error(sc.getLocator(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS, sc.apply( new ComponentNameFunction() ) );
                getErrorReporter().error(sb.getLocation(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_MAP_FALSE, os.getTargetNamespace() );
                if(referer!=null)
                    getErrorReporter().error(referer.getLocator(),
                        Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_REFERER, referer.apply( new ComponentNameFunction() ) );
            }
        }


        queueBuild( sc, bean );
    }

    Binding bind = bindMap.get(sc);
    if( cannotBeDelayed )
        bind.build();

    return bind.bean;
}
 
Example #21
Source File: ClassSelector.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public Binding(XSComponent sc, CTypeInfo bean) {
    this.sc = sc;
    this.bean = bean;
}
 
Example #22
Source File: ClassSelector.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The real meat of the "bindToType" code.
 *
 * @param cannotBeDelayed
 *      if the binding of the body of the class cannot be defered
 *      and needs to be done immediately. If the flag is false,
 *      the binding of the body will be done later, to avoid
 *      cyclic binding problem.
 * @param referer
 *      The component that refers to <tt>sc</tt>. This can be null,
 *      if figuring out the referer is too hard, in which case
 *      the error message might be less user friendly.
 */
// TODO: consider getting rid of "cannotBeDelayed"
CTypeInfo _bindToClass( @NotNull XSComponent sc, XSComponent referer, boolean cannotBeDelayed ) {
    // check if this class is already built.
    if(!bindMap.containsKey(sc)) {
        // craete a bind task

        // if this is a global declaration, make sure they will be generated
        // under a package.
        boolean isGlobal = false;
        if( sc instanceof XSDeclaration ) {
            isGlobal = ((XSDeclaration)sc).isGlobal();
            if( isGlobal )
                pushClassScope( new CClassInfoParent.Package(
                    getPackage(((XSDeclaration)sc).getTargetNamespace())) );
        }

        // otherwise check if this component should become a class.
        CElement bean = sc.apply(classBinder);

        if( isGlobal )
            popClassScope();

        if(bean==null)
            return null;

        // can this namespace generate a class?
        if (bean instanceof CClassInfo) {
            XSSchema os = sc.getOwnerSchema();
            BISchemaBinding sb = builder.getBindInfo(os).get(BISchemaBinding.class);
            if(sb!=null && !sb.map) {
                // nope
                getErrorReporter().error(sc.getLocator(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS, sc.apply( new ComponentNameFunction() ) );
                getErrorReporter().error(sb.getLocation(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_MAP_FALSE, os.getTargetNamespace() );
                if(referer!=null)
                    getErrorReporter().error(referer.getLocator(),
                        Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_REFERER, referer.apply( new ComponentNameFunction() ) );
            }
        }


        queueBuild( sc, bean );
    }

    Binding bind = bindMap.get(sc);
    if( cannotBeDelayed )
        bind.build();

    return bind.bean;
}
 
Example #23
Source File: ClassSelector.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The real meat of the "bindToType" code.
 *
 * @param cannotBeDelayed
 *      if the binding of the body of the class cannot be defered
 *      and needs to be done immediately. If the flag is false,
 *      the binding of the body will be done later, to avoid
 *      cyclic binding problem.
 * @param referer
 *      The component that refers to <tt>sc</tt>. This can be null,
 *      if figuring out the referer is too hard, in which case
 *      the error message might be less user friendly.
 */
// TODO: consider getting rid of "cannotBeDelayed"
CTypeInfo _bindToClass( @NotNull XSComponent sc, XSComponent referer, boolean cannotBeDelayed ) {
    // check if this class is already built.
    if(!bindMap.containsKey(sc)) {
        // craete a bind task

        // if this is a global declaration, make sure they will be generated
        // under a package.
        boolean isGlobal = false;
        if( sc instanceof XSDeclaration ) {
            isGlobal = ((XSDeclaration)sc).isGlobal();
            if( isGlobal )
                pushClassScope( new CClassInfoParent.Package(
                    getPackage(((XSDeclaration)sc).getTargetNamespace())) );
        }

        // otherwise check if this component should become a class.
        CElement bean = sc.apply(classBinder);

        if( isGlobal )
            popClassScope();

        if(bean==null)
            return null;

        // can this namespace generate a class?
        if (bean instanceof CClassInfo) {
            XSSchema os = sc.getOwnerSchema();
            BISchemaBinding sb = builder.getBindInfo(os).get(BISchemaBinding.class);
            if(sb!=null && !sb.map) {
                // nope
                getErrorReporter().error(sc.getLocator(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS, sc.apply( new ComponentNameFunction() ) );
                getErrorReporter().error(sb.getLocation(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_MAP_FALSE, os.getTargetNamespace() );
                if(referer!=null)
                    getErrorReporter().error(referer.getLocator(),
                        Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_REFERER, referer.apply( new ComponentNameFunction() ) );
            }
        }


        queueBuild( sc, bean );
    }

    Binding bind = bindMap.get(sc);
    if( cannotBeDelayed )
        bind.build();

    return bind.bean;
}
 
Example #24
Source File: ClassSelector.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public Binding(XSComponent sc, CTypeInfo bean) {
    this.sc = sc;
    this.bean = bean;
}
 
Example #25
Source File: ClassSelector.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The real meat of the "bindToType" code.
 *
 * @param cannotBeDelayed
 *      if the binding of the body of the class cannot be defered
 *      and needs to be done immediately. If the flag is false,
 *      the binding of the body will be done later, to avoid
 *      cyclic binding problem.
 * @param referer
 *      The component that refers to {@code sc}. This can be null,
 *      if figuring out the referer is too hard, in which case
 *      the error message might be less user friendly.
 */
// TODO: consider getting rid of "cannotBeDelayed"
CTypeInfo _bindToClass( @NotNull XSComponent sc, XSComponent referer, boolean cannotBeDelayed ) {
    // check if this class is already built.
    if(!bindMap.containsKey(sc)) {
        // craete a bind task

        // if this is a global declaration, make sure they will be generated
        // under a package.
        boolean isGlobal = false;
        if( sc instanceof XSDeclaration ) {
            isGlobal = ((XSDeclaration)sc).isGlobal();
            if( isGlobal )
                pushClassScope( new CClassInfoParent.Package(
                    getPackage(((XSDeclaration)sc).getTargetNamespace())) );
        }

        // otherwise check if this component should become a class.
        CElement bean = sc.apply(classBinder);

        if( isGlobal )
            popClassScope();

        if(bean==null)
            return null;

        // can this namespace generate a class?
        if (bean instanceof CClassInfo) {
            XSSchema os = sc.getOwnerSchema();
            BISchemaBinding sb = builder.getBindInfo(os).get(BISchemaBinding.class);
            if(sb!=null && !sb.map) {
                // nope
                getErrorReporter().error(sc.getLocator(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS, sc.apply( new ComponentNameFunction() ) );
                getErrorReporter().error(sb.getLocation(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_MAP_FALSE, os.getTargetNamespace() );
                if(referer!=null)
                    getErrorReporter().error(referer.getLocator(),
                        Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_REFERER, referer.apply( new ComponentNameFunction() ) );
            }
        }


        queueBuild( sc, bean );
    }

    Binding bind = bindMap.get(sc);
    if( cannotBeDelayed )
        bind.build();

    return bind.bean;
}
 
Example #26
Source File: ClassSelector.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public Binding(XSComponent sc, CTypeInfo bean) {
    this.sc = sc;
    this.bean = bean;
}
 
Example #27
Source File: ClassSelector.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public Binding(XSComponent sc, CTypeInfo bean) {
    this.sc = sc;
    this.bean = bean;
}
 
Example #28
Source File: ClassSelector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The real meat of the "bindToType" code.
 *
 * @param cannotBeDelayed
 *      if the binding of the body of the class cannot be defered
 *      and needs to be done immediately. If the flag is false,
 *      the binding of the body will be done later, to avoid
 *      cyclic binding problem.
 * @param referer
 *      The component that refers to <tt>sc</tt>. This can be null,
 *      if figuring out the referer is too hard, in which case
 *      the error message might be less user friendly.
 */
// TODO: consider getting rid of "cannotBeDelayed"
CTypeInfo _bindToClass( @NotNull XSComponent sc, XSComponent referer, boolean cannotBeDelayed ) {
    // check if this class is already built.
    if(!bindMap.containsKey(sc)) {
        // craete a bind task

        // if this is a global declaration, make sure they will be generated
        // under a package.
        boolean isGlobal = false;
        if( sc instanceof XSDeclaration ) {
            isGlobal = ((XSDeclaration)sc).isGlobal();
            if( isGlobal )
                pushClassScope( new CClassInfoParent.Package(
                    getPackage(((XSDeclaration)sc).getTargetNamespace())) );
        }

        // otherwise check if this component should become a class.
        CElement bean = sc.apply(classBinder);

        if( isGlobal )
            popClassScope();

        if(bean==null)
            return null;

        // can this namespace generate a class?
        if (bean instanceof CClassInfo) {
            XSSchema os = sc.getOwnerSchema();
            BISchemaBinding sb = builder.getBindInfo(os).get(BISchemaBinding.class);
            if(sb!=null && !sb.map) {
                // nope
                getErrorReporter().error(sc.getLocator(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS, sc.apply( new ComponentNameFunction() ) );
                getErrorReporter().error(sb.getLocation(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_MAP_FALSE, os.getTargetNamespace() );
                if(referer!=null)
                    getErrorReporter().error(referer.getLocator(),
                        Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_REFERER, referer.apply( new ComponentNameFunction() ) );
            }
        }


        queueBuild( sc, bean );
    }

    Binding bind = bindMap.get(sc);
    if( cannotBeDelayed )
        bind.build();

    return bind.bean;
}
 
Example #29
Source File: ClassSelector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public Binding(XSComponent sc, CTypeInfo bean) {
    this.sc = sc;
    this.bean = bean;
}
 
Example #30
Source File: ClassSelector.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The real meat of the "bindToType" code.
 *
 * @param cannotBeDelayed
 *      if the binding of the body of the class cannot be defered
 *      and needs to be done immediately. If the flag is false,
 *      the binding of the body will be done later, to avoid
 *      cyclic binding problem.
 * @param referer
 *      The component that refers to <tt>sc</tt>. This can be null,
 *      if figuring out the referer is too hard, in which case
 *      the error message might be less user friendly.
 */
// TODO: consider getting rid of "cannotBeDelayed"
CTypeInfo _bindToClass( @NotNull XSComponent sc, XSComponent referer, boolean cannotBeDelayed ) {
    // check if this class is already built.
    if(!bindMap.containsKey(sc)) {
        // craete a bind task

        // if this is a global declaration, make sure they will be generated
        // under a package.
        boolean isGlobal = false;
        if( sc instanceof XSDeclaration ) {
            isGlobal = ((XSDeclaration)sc).isGlobal();
            if( isGlobal )
                pushClassScope( new CClassInfoParent.Package(
                    getPackage(((XSDeclaration)sc).getTargetNamespace())) );
        }

        // otherwise check if this component should become a class.
        CElement bean = sc.apply(classBinder);

        if( isGlobal )
            popClassScope();

        if(bean==null)
            return null;

        // can this namespace generate a class?
        if (bean instanceof CClassInfo) {
            XSSchema os = sc.getOwnerSchema();
            BISchemaBinding sb = builder.getBindInfo(os).get(BISchemaBinding.class);
            if(sb!=null && !sb.map) {
                // nope
                getErrorReporter().error(sc.getLocator(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS, sc.apply( new ComponentNameFunction() ) );
                getErrorReporter().error(sb.getLocation(),
                    Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_MAP_FALSE, os.getTargetNamespace() );
                if(referer!=null)
                    getErrorReporter().error(referer.getLocator(),
                        Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_REFERER, referer.apply( new ComponentNameFunction() ) );
            }
        }


        queueBuild( sc, bean );
    }

    Binding bind = bindMap.get(sc);
    if( cannotBeDelayed )
        bind.build();

    return bind.bean;
}