Java Code Examples for com.sun.tools.internal.xjc.reader.Ring#get()

The following examples show how to use com.sun.tools.internal.xjc.reader.Ring#get() . 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: RawTypeSetBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example 2
Source File: RawTypeSetBuilder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public XmlTypeRef(XSElementDecl decl) {
    this.decl = decl;
    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    stb.refererStack.push(decl);
    TypeUse r = Ring.get(ClassSelector.class).bindToType(decl.getType(),decl);
    stb.refererStack.pop();
    target = r;
}
 
Example 3
Source File: BIGlobalBinding.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
JDefinedClass getClazz(ClassType t) {
    if (clazz != null) return clazz;
    try {
        JCodeModel codeModel = Ring.get(JCodeModel.class);
        clazz = codeModel._class(name, t);
        clazz.hide();
        return clazz;
    } catch (JClassAlreadyExistsException e) {
        return e.getExistingClass();
    }
}
 
Example 4
Source File: ColorBinder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected final void createSimpleTypeProperty(XSSimpleType type,String propName) {
    BIProperty prop = BIProperty.getCustomization(type);

    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    // since we are building the simple type here, use buildDef
    CPropertyInfo p = prop.createValueProperty(propName,false,type,stb.buildDef(type),BGMBuilder.getName(type));
    getCurrentBean().addProperty(p);
}
 
Example 5
Source File: RawTypeSetBuilder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public XmlTypeRef(XSElementDecl decl) {
    this.decl = decl;
    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    stb.refererStack.push(decl);
    TypeUse r = Ring.get(ClassSelector.class).bindToType(decl.getType(),decl);
    stb.refererStack.pop();
    target = r;
}
 
Example 6
Source File: ColorBinder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected final void createSimpleTypeProperty(XSSimpleType type,String propName) {
    BIProperty prop = BIProperty.getCustomization(type);

    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    // since we are building the simple type here, use buildDef
    CPropertyInfo p = prop.createValueProperty(propName,false,type,stb.buildDef(type),BGMBuilder.getName(type));
    getCurrentBean().addProperty(p);
}
 
Example 7
Source File: ColorBinder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected final void createSimpleTypeProperty(XSSimpleType type,String propName) {
    BIProperty prop = BIProperty.getCustomization(type);

    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    // since we are building the simple type here, use buildDef
    CPropertyInfo p = prop.createValueProperty(propName,false,type,stb.buildDef(type),BGMBuilder.getName(type));
    getCurrentBean().addProperty(p);
}
 
Example 8
Source File: RawTypeSetBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public XmlTypeRef(XSElementDecl decl) {
    this.decl = decl;
    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    stb.refererStack.push(decl);
    TypeUse r = Ring.get(ClassSelector.class).bindToType(decl.getType(),decl);
    stb.refererStack.pop();
    target = r;
}
 
Example 9
Source File: BindRed.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void elementDecl(XSElementDecl e) {
    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    stb.refererStack.push(e);    // referer is element
    builder.ying(e.getType(),e);
    stb.refererStack.pop();
}
 
Example 10
Source File: ParticleBinder.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected final ErrorReporter getErrorReporter() {
    return Ring.get(ErrorReporter.class);
}
 
Example 11
Source File: BindingComponent.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected final ClassSelector getClassSelector() {
    return Ring.get(ClassSelector.class);
}
 
Example 12
Source File: AbstractDeclarationImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected final JCodeModel getCodeModel() {
    return Ring.get(JCodeModel.class);
}
 
Example 13
Source File: BindRed.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void simpleType(XSSimpleType type) {
    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    stb.refererStack.push(type);    // referer is itself
    createSimpleTypeProperty(type,"Value");
    stb.refererStack.pop();
}
 
Example 14
Source File: BindRed.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void simpleType(XSSimpleType type) {
    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    stb.refererStack.push(type);    // referer is itself
    createSimpleTypeProperty(type,"Value");
    stb.refererStack.pop();
}
 
Example 15
Source File: BindingComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected final ClassSelector getClassSelector() {
    return Ring.get(ClassSelector.class);
}
 
Example 16
Source File: ParticleBinder.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected final ClassSelector getClassSelector() {
    return Ring.get(ClassSelector.class);
}
 
Example 17
Source File: BindRed.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void simpleType(XSSimpleType type) {
    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    stb.refererStack.push(type);    // referer is itself
    createSimpleTypeProperty(type,"Value");
    stb.refererStack.pop();
}
 
Example 18
Source File: BIProperty.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Finds a property customization that describes how the given
 * component should be mapped to a property (if it's mapped to
 * a property at all.)
 *
 * <p>
 * Consider an attribute use that does NOT carry a property
 * customization. This schema component is nonetheless considered
 * to carry a (sort of) implicit property customization, whose values
 * are defaulted.
 *
 * <p>
 * This method can be think of the method that returns this implied
 * property customization.
 *
 * <p>
 * Note that this doesn't mean the given component needs to be
 * mapped to a property. But if it does map to a property, it needs
 * to follow this customization.
 *
 * I think this semantics is next to non-sense but I couldn't think
 * of any other way to follow the spec.
 *
 * @param c
 *      A customization effective on this component will be returned.
 *      Can be null just to get the global customization.
 * @return
 *      Always return non-null valid object.
 */
public static BIProperty getCustomization( XSComponent c ) {
    BGMBuilder builder = Ring.get(BGMBuilder.class);

    // look for a customization on this component
    if( c!=null ) {
        BIProperty prop = builder.getBindInfo(c).get(BIProperty.class);
        if(prop!=null)  return prop;
    }

    // if no such thing exists, defeault.
    return getDefault(builder,c);
}
 
Example 19
Source File: BIProperty.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Finds a property customization that describes how the given
 * component should be mapped to a property (if it's mapped to
 * a property at all.)
 *
 * <p>
 * Consider an attribute use that does NOT carry a property
 * customization. This schema component is nonetheless considered
 * to carry a (sort of) implicit property customization, whose values
 * are defaulted.
 *
 * <p>
 * This method can be think of the method that returns this implied
 * property customization.
 *
 * <p>
 * Note that this doesn't mean the given component needs to be
 * mapped to a property. But if it does map to a property, it needs
 * to follow this customization.
 *
 * I think this semantics is next to non-sense but I couldn't think
 * of any other way to follow the spec.
 *
 * @param c
 *      A customization effective on this component will be returned.
 *      Can be null just to get the global customization.
 * @return
 *      Always return non-null valid object.
 */
public static BIProperty getCustomization( XSComponent c ) {
    BGMBuilder builder = Ring.get(BGMBuilder.class);

    // look for a customization on this component
    if( c!=null ) {
        BIProperty prop = builder.getBindInfo(c).get(BIProperty.class);
        if(prop!=null)  return prop;
    }

    // if no such thing exists, defeault.
    return getDefault(builder,c);
}
 
Example 20
Source File: BIProperty.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Finds a property customization that describes how the given
 * component should be mapped to a property (if it's mapped to
 * a property at all.)
 *
 * <p>
 * Consider an attribute use that does NOT carry a property
 * customization. This schema component is nonetheless considered
 * to carry a (sort of) implicit property customization, whose values
 * are defaulted.
 *
 * <p>
 * This method can be think of the method that returns this implied
 * property customization.
 *
 * <p>
 * Note that this doesn't mean the given component needs to be
 * mapped to a property. But if it does map to a property, it needs
 * to follow this customization.
 *
 * I think this semantics is next to non-sense but I couldn't think
 * of any other way to follow the spec.
 *
 * @param c
 *      A customization effective on this component will be returned.
 *      Can be null just to get the global customization.
 * @return
 *      Always return non-null valid object.
 */
public static BIProperty getCustomization( XSComponent c ) {
    BGMBuilder builder = Ring.get(BGMBuilder.class);

    // look for a customization on this component
    if( c!=null ) {
        BIProperty prop = builder.getBindInfo(c).get(BIProperty.class);
        if(prop!=null)  return prop;
    }

    // if no such thing exists, defeault.
    return getDefault(builder,c);
}