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

The following examples show how to use com.sun.tools.internal.xjc.model.TypeUseFactory. 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: BIConversion.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public TypeUse getTypeUse(XSSimpleType owner) {
    if(typeUse!=null)
        return typeUse;

    JCodeModel cm = getCodeModel();

    JDefinedClass a;
    try {
        a = cm._class(adapter);
        a.hide();   // we assume this is given by the user
        a._extends(cm.ref(XmlAdapter.class).narrow(String.class).narrow(
                cm.ref(type)));
    } catch (JClassAlreadyExistsException e) {
        a = e.getExistingClass();
    }

    // TODO: it's not correct to say that it adapts from String,
    // but OTOH I don't think we can compute that.
    typeUse = TypeUseFactory.adapt(
            CBuiltinLeafInfo.STRING,
            new CAdapter(a));

    return typeUse;
}
 
Example #2
Source File: BIConversion.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public TypeUse getTypeUse(XSSimpleType owner) {
    if(typeUse!=null)
        return typeUse;

    JCodeModel cm = getCodeModel();

    JDefinedClass a;
    try {
        a = cm._class(adapter);
        a.hide();   // we assume this is given by the user
        a._extends(cm.ref(XmlAdapter.class).narrow(String.class).narrow(
                cm.ref(type)));
    } catch (JClassAlreadyExistsException e) {
        a = e.getExistingClass();
    }

    // TODO: it's not correct to say that it adapts from String,
    // but OTOH I don't think we can compute that.
    typeUse = TypeUseFactory.adapt(
            CBuiltinLeafInfo.STRING,
            new CAdapter(a));

    return typeUse;
}
 
Example #3
Source File: BIConversion.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public TypeUse getTypeUse(XSSimpleType owner) {
    if(typeUse!=null)
        return typeUse;

    JCodeModel cm = getCodeModel();

    JDefinedClass a;
    try {
        a = cm._class(adapter);
        a.hide();   // we assume this is given by the user
        a._extends(cm.ref(XmlAdapter.class).narrow(String.class).narrow(
                cm.ref(type)));
    } catch (JClassAlreadyExistsException e) {
        a = e.getExistingClass();
    }

    // TODO: it's not correct to say that it adapts from String,
    // but OTOH I don't think we can compute that.
    typeUse = TypeUseFactory.adapt(
            CBuiltinLeafInfo.STRING,
            new CAdapter(a));

    return typeUse;
}
 
Example #4
Source File: BIConversion.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public TypeUse getTypeUse(XSSimpleType owner) {
    if(typeUse!=null)
        return typeUse;

    JCodeModel cm = getCodeModel();

    JDefinedClass a;
    try {
        a = cm._class(adapter);
        a.hide();   // we assume this is given by the user
        a._extends(cm.ref(XmlAdapter.class).narrow(String.class).narrow(
                cm.ref(type)));
    } catch (JClassAlreadyExistsException e) {
        a = e.getExistingClass();
    }

    // TODO: it's not correct to say that it adapts from String,
    // but OTOH I don't think we can compute that.
    typeUse = TypeUseFactory.adapt(
            CBuiltinLeafInfo.STRING,
            new CAdapter(a));

    return typeUse;
}
 
Example #5
Source File: BIConversion.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public TypeUse getTypeUse(XSSimpleType owner) {
    if(typeUse!=null)
        return typeUse;

    JCodeModel cm = getCodeModel();

    JDefinedClass a;
    try {
        a = cm._class(adapter);
        a.hide();   // we assume this is given by the user
        a._extends(cm.ref(XmlAdapter.class).narrow(String.class).narrow(
                cm.ref(type)));
    } catch (JClassAlreadyExistsException e) {
        a = e.getExistingClass();
    }

    // TODO: it's not correct to say that it adapts from String,
    // but OTOH I don't think we can compute that.
    typeUse = TypeUseFactory.adapt(
            CBuiltinLeafInfo.STRING,
            new CAdapter(a));

    return typeUse;
}
 
Example #6
Source File: BIConversion.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public TypeUse getTypeUse(XSSimpleType owner) {
    if(typeUse!=null)
        return typeUse;

    JCodeModel cm = getCodeModel();

    JDefinedClass a;
    try {
        a = cm._class(adapter);
        a.hide();   // we assume this is given by the user
        a._extends(cm.ref(XmlAdapter.class).narrow(String.class).narrow(
                cm.ref(type)));
    } catch (JClassAlreadyExistsException e) {
        a = e.getExistingClass();
    }

    // TODO: it's not correct to say that it adapts from String,
    // but OTOH I don't think we can compute that.
    typeUse = TypeUseFactory.adapt(
            CBuiltinLeafInfo.STRING,
            new CAdapter(a));

    return typeUse;
}
 
Example #7
Source File: BIConversion.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public TypeUse getTypeUse(XSSimpleType owner) {
    if(typeUse!=null)
        return typeUse;

    JCodeModel cm = getCodeModel();

    JDefinedClass a;
    try {
        a = cm._class(adapter);
        a.hide();   // we assume this is given by the user
        a._extends(cm.ref(XmlAdapter.class).narrow(String.class).narrow(
                cm.ref(type)));
    } catch (JClassAlreadyExistsException e) {
        a = e.getExistingClass();
    }

    // TODO: it's not correct to say that it adapts from String,
    // but OTOH I don't think we can compute that.
    typeUse = TypeUseFactory.adapt(
            CBuiltinLeafInfo.STRING,
            new CAdapter(a));

    return typeUse;
}
 
Example #8
Source File: BIConversion.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public TypeUse getTypeUse(XSSimpleType owner) {
    if(typeUse!=null)
        return typeUse;

    JCodeModel cm = getCodeModel();

    JDefinedClass a;
    try {
        a = cm._class(adapter);
        a.hide();   // we assume this is given by the user
        a._extends(cm.ref(XmlAdapter.class).narrow(String.class).narrow(
                cm.ref(type)));
    } catch (JClassAlreadyExistsException e) {
        a = e.getExistingClass();
    }

    // TODO: it's not correct to say that it adapts from String,
    // but OTOH I don't think we can compute that.
    typeUse = TypeUseFactory.adapt(
            CBuiltinLeafInfo.STRING,
            new CAdapter(a));

    return typeUse;
}
 
Example #9
Source File: ElementMappingImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected ElementMappingImpl(JAXBModelImpl parent, CElementInfo elementInfo) {
    super(parent,elementInfo);

    TypeUse t = clazz.getContentType();
    if(clazz.getProperty().isCollection())
        t = TypeUseFactory.makeCollection(t);
    CAdapter a = clazz.getProperty().getAdapter();
    if(a!=null)
        t = TypeUseFactory.adapt(t,a);
    taa = new TypeAndAnnotationImpl(parent.outline,t);
}
 
Example #10
Source File: ElementMappingImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected ElementMappingImpl(JAXBModelImpl parent, CElementInfo elementInfo) {
    super(parent,elementInfo);

    TypeUse t = clazz.getContentType();
    if(clazz.getProperty().isCollection())
        t = TypeUseFactory.makeCollection(t);
    CAdapter a = clazz.getProperty().getAdapter();
    if(a!=null)
        t = TypeUseFactory.adapt(t,a);
    taa = new TypeAndAnnotationImpl(parent.outline,t);
}
 
Example #11
Source File: SimpleTypeBuilder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse unionSimpleType(XSUnionSimpleType type) {
    boolean isCollection = false;
    for( int i=0; i<type.getMemberSize(); i++ )
        if(type.getMember(i).getVariety()==XSVariety.LIST || type.getMember(i).getVariety()==XSVariety.UNION) {
            isCollection = true;
            break;
        }

    TypeUse r = CBuiltinLeafInfo.STRING;
    if(isCollection)
        r = TypeUseFactory.makeCollection(r);
    return r;
}
 
Example #12
Source File: SimpleTypeBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse listSimpleType(XSListSimpleType type) {
    // bind item type individually and then compose them into a list
    // facets on the list shouldn't be taken account when binding item types,
    // so weed to call build(), not compose().
    XSSimpleType itemType = type.getItemType();
    refererStack.push(itemType);
    TypeUse tu = TypeUseFactory.makeCollection(build(type.getItemType()));
    refererStack.pop();
    return tu;
}
 
Example #13
Source File: SimpleTypeBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse unionSimpleType(XSUnionSimpleType type) {
    boolean isCollection = false;
    for( int i=0; i<type.getMemberSize(); i++ )
        if(type.getMember(i).getVariety()==XSVariety.LIST || type.getMember(i).getVariety()==XSVariety.UNION) {
            isCollection = true;
            break;
        }

    TypeUse r = CBuiltinLeafInfo.STRING;
    if(isCollection)
        r = TypeUseFactory.makeCollection(r);
    return r;
}
 
Example #14
Source File: SimpleTypeBuilder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse listSimpleType(XSListSimpleType type) {
    // bind item type individually and then compose them into a list
    // facets on the list shouldn't be taken account when binding item types,
    // so weed to call build(), not compose().
    XSSimpleType itemType = type.getItemType();
    refererStack.push(itemType);
    TypeUse tu = TypeUseFactory.makeCollection(build(type.getItemType()));
    refererStack.pop();
    return tu;
}
 
Example #15
Source File: ElementMappingImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected ElementMappingImpl(JAXBModelImpl parent, CElementInfo elementInfo) {
    super(parent,elementInfo);

    TypeUse t = clazz.getContentType();
    if(clazz.getProperty().isCollection())
        t = TypeUseFactory.makeCollection(t);
    CAdapter a = clazz.getProperty().getAdapter();
    if(a!=null)
        t = TypeUseFactory.adapt(t,a);
    taa = new TypeAndAnnotationImpl(parent.outline,t);
}
 
Example #16
Source File: SimpleTypeBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse listSimpleType(XSListSimpleType type) {
    // bind item type individually and then compose them into a list
    // facets on the list shouldn't be taken account when binding item types,
    // so weed to call build(), not compose().
    XSSimpleType itemType = type.getItemType();
    refererStack.push(itemType);
    TypeUse tu = TypeUseFactory.makeCollection(build(type.getItemType()));
    refererStack.pop();
    return tu;
}
 
Example #17
Source File: SimpleTypeBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse unionSimpleType(XSUnionSimpleType type) {
    boolean isCollection = false;
    for( int i=0; i<type.getMemberSize(); i++ )
        if(type.getMember(i).getVariety()==XSVariety.LIST || type.getMember(i).getVariety()==XSVariety.UNION) {
            isCollection = true;
            break;
        }

    TypeUse r = CBuiltinLeafInfo.STRING;
    if(isCollection)
        r = TypeUseFactory.makeCollection(r);
    return r;
}
 
Example #18
Source File: ElementMappingImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected ElementMappingImpl(JAXBModelImpl parent, CElementInfo elementInfo) {
    super(parent,elementInfo);

    TypeUse t = clazz.getContentType();
    if(clazz.getProperty().isCollection())
        t = TypeUseFactory.makeCollection(t);
    CAdapter a = clazz.getProperty().getAdapter();
    if(a!=null)
        t = TypeUseFactory.adapt(t,a);
    taa = new TypeAndAnnotationImpl(parent.outline,t);
}
 
Example #19
Source File: ElementMappingImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected ElementMappingImpl(JAXBModelImpl parent, CElementInfo elementInfo) {
    super(parent,elementInfo);

    TypeUse t = clazz.getContentType();
    if(clazz.getProperty().isCollection())
        t = TypeUseFactory.makeCollection(t);
    CAdapter a = clazz.getProperty().getAdapter();
    if(a!=null)
        t = TypeUseFactory.adapt(t,a);
    taa = new TypeAndAnnotationImpl(parent.outline,t);
}
 
Example #20
Source File: SimpleTypeBuilder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse listSimpleType(XSListSimpleType type) {
    // bind item type individually and then compose them into a list
    // facets on the list shouldn't be taken account when binding item types,
    // so weed to call build(), not compose().
    XSSimpleType itemType = type.getItemType();
    refererStack.push(itemType);
    TypeUse tu = TypeUseFactory.makeCollection(build(type.getItemType()));
    refererStack.pop();
    return tu;
}
 
Example #21
Source File: SimpleTypeBuilder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse unionSimpleType(XSUnionSimpleType type) {
    boolean isCollection = false;
    for( int i=0; i<type.getMemberSize(); i++ )
        if(type.getMember(i).getVariety()==XSVariety.LIST || type.getMember(i).getVariety()==XSVariety.UNION) {
            isCollection = true;
            break;
        }

    TypeUse r = CBuiltinLeafInfo.STRING;
    if(isCollection)
        r = TypeUseFactory.makeCollection(r);
    return r;
}
 
Example #22
Source File: SimpleTypeBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse unionSimpleType(XSUnionSimpleType type) {
    boolean isCollection = false;
    for( int i=0; i<type.getMemberSize(); i++ )
        if(type.getMember(i).getVariety()==XSVariety.LIST || type.getMember(i).getVariety()==XSVariety.UNION) {
            isCollection = true;
            break;
        }

    TypeUse r = CBuiltinLeafInfo.STRING;
    if(isCollection)
        r = TypeUseFactory.makeCollection(r);
    return r;
}
 
Example #23
Source File: SimpleTypeBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse listSimpleType(XSListSimpleType type) {
    // bind item type individually and then compose them into a list
    // facets on the list shouldn't be taken account when binding item types,
    // so weed to call build(), not compose().
    XSSimpleType itemType = type.getItemType();
    refererStack.push(itemType);
    TypeUse tu = TypeUseFactory.makeCollection(build(type.getItemType()));
    refererStack.pop();
    return tu;
}
 
Example #24
Source File: ElementMappingImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected ElementMappingImpl(JAXBModelImpl parent, CElementInfo elementInfo) {
    super(parent,elementInfo);

    TypeUse t = clazz.getContentType();
    if(clazz.getProperty().isCollection())
        t = TypeUseFactory.makeCollection(t);
    CAdapter a = clazz.getProperty().getAdapter();
    if(a!=null)
        t = TypeUseFactory.adapt(t,a);
    taa = new TypeAndAnnotationImpl(parent.outline,t);
}
 
Example #25
Source File: ElementMappingImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected ElementMappingImpl(JAXBModelImpl parent, CElementInfo elementInfo) {
    super(parent,elementInfo);

    TypeUse t = clazz.getContentType();
    if(clazz.getProperty().isCollection())
        t = TypeUseFactory.makeCollection(t);
    CAdapter a = clazz.getProperty().getAdapter();
    if(a!=null)
        t = TypeUseFactory.adapt(t,a);
    taa = new TypeAndAnnotationImpl(parent.outline,t);
}
 
Example #26
Source File: SimpleTypeBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse listSimpleType(XSListSimpleType type) {
    // bind item type individually and then compose them into a list
    // facets on the list shouldn't be taken account when binding item types,
    // so weed to call build(), not compose().
    XSSimpleType itemType = type.getItemType();
    refererStack.push(itemType);
    TypeUse tu = TypeUseFactory.makeCollection(build(type.getItemType()));
    refererStack.pop();
    return tu;
}
 
Example #27
Source File: SimpleTypeBuilder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse unionSimpleType(XSUnionSimpleType type) {
    boolean isCollection = false;
    for( int i=0; i<type.getMemberSize(); i++ )
        if(type.getMember(i).getVariety()==XSVariety.LIST || type.getMember(i).getVariety()==XSVariety.UNION) {
            isCollection = true;
            break;
        }

    TypeUse r = CBuiltinLeafInfo.STRING;
    if(isCollection)
        r = TypeUseFactory.makeCollection(r);
    return r;
}
 
Example #28
Source File: SimpleTypeBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse unionSimpleType(XSUnionSimpleType type) {
    boolean isCollection = false;
    for( int i=0; i<type.getMemberSize(); i++ )
        if(type.getMember(i).getVariety()==XSVariety.LIST || type.getMember(i).getVariety()==XSVariety.UNION) {
            isCollection = true;
            break;
        }

    TypeUse r = CBuiltinLeafInfo.STRING;
    if(isCollection)
        r = TypeUseFactory.makeCollection(r);
    return r;
}
 
Example #29
Source File: SimpleTypeBuilder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse listSimpleType(XSListSimpleType type) {
    // bind item type individually and then compose them into a list
    // facets on the list shouldn't be taken account when binding item types,
    // so weed to call build(), not compose().
    XSSimpleType itemType = type.getItemType();
    refererStack.push(itemType);
    TypeUse tu = TypeUseFactory.makeCollection(build(type.getItemType()));
    refererStack.pop();
    return tu;
}
 
Example #30
Source File: SimpleTypeBuilder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public TypeUse listSimpleType(XSListSimpleType type) {
    // bind item type individually and then compose them into a list
    // facets on the list shouldn't be taken account when binding item types,
    // so weed to call build(), not compose().
    XSSimpleType itemType = type.getItemType();
    refererStack.push(itemType);
    TypeUse tu = TypeUseFactory.makeCollection(build(type.getItemType()));
    refererStack.pop();
    return tu;
}