com.sun.codemodel.internal.JClassAlreadyExistsException Java Examples

The following examples show how to use com.sun.codemodel.internal.JClassAlreadyExistsException. 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 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 #2
Source File: BindInfo.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superClass customization if it's turned on. */
public JClass getSuperClass() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superClass");
    if (sc == null) return null;

    JDefinedClass c;

    try {
        String v = DOMUtil.getAttribute(sc,"name");
        if(v==null)     return null;
        c = codeModel._class(v);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #3
Source File: BindInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
    if (sc == null) return null;

    String name = DOMUtil.getAttribute(sc,"name");
    if (name == null) return null;

    JDefinedClass c;

    try {
        c = codeModel._class(name, ClassType.INTERFACE);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #4
Source File: BeanGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private ClassOutlineImpl generateClassDef(CClassInfo bean) {
    ImplStructureStrategy.Result r = model.strategy.createClasses(this, bean);
    JClass implRef;

    if (bean.getUserSpecifiedImplClass() != null) {
        // create a place holder for a user-specified class.
        JDefinedClass usr;
        try {
            usr = codeModel._class(bean.getUserSpecifiedImplClass());
            // but hide that file so that it won't be generated.
            usr.hide();
        } catch (JClassAlreadyExistsException e) {
            // it's OK for this to collide.
            usr = e.getExistingClass();
        }
        usr._extends(r.implementation);
        implRef = usr;
    } else {
        implRef = r.implementation;
    }

    return new ClassOutlineImpl(this, bean, r.exposed, r.implementation, implRef);
}
 
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-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 #7
Source File: BindInfo.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
    if (sc == null) return null;

    String name = DOMUtil.getAttribute(sc,"name");
    if (name == null) return null;

    JDefinedClass c;

    try {
        c = codeModel._class(name, ClassType.INTERFACE);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #8
Source File: BindInfo.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superClass customization if it's turned on. */
public JClass getSuperClass() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superClass");
    if (sc == null) return null;

    JDefinedClass c;

    try {
        String v = DOMUtil.getAttribute(sc,"name");
        if(v==null)     return null;
        c = codeModel._class(v);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #9
Source File: BindInfo.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superClass customization if it's turned on. */
public JClass getSuperClass() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superClass");
    if (sc == null) return null;

    JDefinedClass c;

    try {
        String v = DOMUtil.getAttribute(sc,"name");
        if(v==null)     return null;
        c = codeModel._class(v);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #10
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 #11
Source File: BeanGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private ClassOutlineImpl generateClassDef(CClassInfo bean) {
    ImplStructureStrategy.Result r = model.strategy.createClasses(this, bean);
    JClass implRef;

    if (bean.getUserSpecifiedImplClass() != null) {
        // create a place holder for a user-specified class.
        JDefinedClass usr;
        try {
            usr = codeModel._class(bean.getUserSpecifiedImplClass());
            // but hide that file so that it won't be generated.
            usr.hide();
        } catch (JClassAlreadyExistsException e) {
            // it's OK for this to collide.
            usr = e.getExistingClass();
        }
        usr._extends(r.implementation);
        implRef = usr;
    } else {
        implRef = r.implementation;
    }

    return new ClassOutlineImpl(this, bean, r.exposed, r.implementation, implRef);
}
 
Example #12
Source File: BindInfo.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
    if (sc == null) return null;

    String name = DOMUtil.getAttribute(sc,"name");
    if (name == null) return null;

    JDefinedClass c;

    try {
        c = codeModel._class(name, ClassType.INTERFACE);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #13
Source File: BindInfo.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
    if (sc == null) return null;

    String name = DOMUtil.getAttribute(sc,"name");
    if (name == null) return null;

    JDefinedClass c;

    try {
        c = codeModel._class(name, ClassType.INTERFACE);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #14
Source File: BindInfo.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superClass customization if it's turned on. */
public JClass getSuperClass() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superClass");
    if (sc == null) return null;

    JDefinedClass c;

    try {
        String v = DOMUtil.getAttribute(sc,"name");
        if(v==null)     return null;
        c = codeModel._class(v);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #15
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 #16
Source File: BindInfo.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
    if (sc == null) return null;

    String name = DOMUtil.getAttribute(sc,"name");
    if (name == null) return null;

    JDefinedClass c;

    try {
        c = codeModel._class(name, ClassType.INTERFACE);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #17
Source File: BeanGenerator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private ClassOutlineImpl generateClassDef(CClassInfo bean) {
    ImplStructureStrategy.Result r = model.strategy.createClasses(this, bean);
    JClass implRef;

    if (bean.getUserSpecifiedImplClass() != null) {
        // create a place holder for a user-specified class.
        JDefinedClass usr;
        try {
            usr = codeModel._class(bean.getUserSpecifiedImplClass());
            // but hide that file so that it won't be generated.
            usr.hide();
        } catch (JClassAlreadyExistsException e) {
            // it's OK for this to collide.
            usr = e.getExistingClass();
        }
        usr._extends(r.implementation);
        implRef = usr;
    } else {
        implRef = r.implementation;
    }

    return new ClassOutlineImpl(this, bean, r.exposed, r.implementation, implRef);
}
 
Example #18
Source File: BeanGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private ClassOutlineImpl generateClassDef(CClassInfo bean) {
    ImplStructureStrategy.Result r = model.strategy.createClasses(this, bean);
    JClass implRef;

    if (bean.getUserSpecifiedImplClass() != null) {
        // create a place holder for a user-specified class.
        JDefinedClass usr;
        try {
            usr = codeModel._class(bean.getUserSpecifiedImplClass());
            // but hide that file so that it won't be generated.
            usr.hide();
        } catch (JClassAlreadyExistsException e) {
            // it's OK for this to collide.
            usr = e.getExistingClass();
        }
        usr._extends(r.implementation);
        implRef = usr;
    } else {
        implRef = r.implementation;
    }

    return new ClassOutlineImpl(this, bean, r.exposed, r.implementation, implRef);
}
 
Example #19
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 #20
Source File: BeanGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private ClassOutlineImpl generateClassDef(CClassInfo bean) {
    ImplStructureStrategy.Result r = model.strategy.createClasses(this, bean);
    JClass implRef;

    if (bean.getUserSpecifiedImplClass() != null) {
        // create a place holder for a user-specified class.
        JDefinedClass usr;
        try {
            usr = codeModel._class(bean.getUserSpecifiedImplClass());
            // but hide that file so that it won't be generated.
            usr.hide();
        } catch (JClassAlreadyExistsException e) {
            // it's OK for this to collide.
            usr = e.getExistingClass();
        }
        usr._extends(r.implementation);
        implRef = usr;
    } else {
        implRef = r.implementation;
    }

    return new ClassOutlineImpl(this, bean, r.exposed, r.implementation, implRef);
}
 
Example #21
Source File: BindInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superClass customization if it's turned on. */
public JClass getSuperClass() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superClass");
    if (sc == null) return null;

    JDefinedClass c;

    try {
        String v = DOMUtil.getAttribute(sc,"name");
        if(v==null)     return null;
        c = codeModel._class(v);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #22
Source File: BindInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
    if (sc == null) return null;

    String name = DOMUtil.getAttribute(sc,"name");
    if (name == null) return null;

    JDefinedClass c;

    try {
        c = codeModel._class(name, ClassType.INTERFACE);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #23
Source File: BeanGenerator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private ClassOutlineImpl generateClassDef(CClassInfo bean) {
    ImplStructureStrategy.Result r = model.strategy.createClasses(this, bean);
    JClass implRef;

    if (bean.getUserSpecifiedImplClass() != null) {
        // create a place holder for a user-specified class.
        JDefinedClass usr;
        try {
            usr = codeModel._class(bean.getUserSpecifiedImplClass());
            // but hide that file so that it won't be generated.
            usr.hide();
        } catch (JClassAlreadyExistsException e) {
            // it's OK for this to collide.
            usr = e.getExistingClass();
        }
        usr._extends(r.implementation);
        implRef = usr;
    } else {
        implRef = r.implementation;
    }

    return new ClassOutlineImpl(this, bean, r.exposed, r.implementation, implRef);
}
 
Example #24
Source File: BindInfo.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
    if (sc == null) return null;

    String name = DOMUtil.getAttribute(sc,"name");
    if (name == null) return null;

    JDefinedClass c;

    try {
        c = codeModel._class(name, ClassType.INTERFACE);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #25
Source File: BindInfo.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superClass customization if it's turned on. */
public JClass getSuperClass() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superClass");
    if (sc == null) return null;

    JDefinedClass c;

    try {
        String v = DOMUtil.getAttribute(sc,"name");
        if(v==null)     return null;
        c = codeModel._class(v);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #26
Source File: BindInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
    if (sc == null) return null;

    String name = DOMUtil.getAttribute(sc,"name");
    if (name == null) return null;

    JDefinedClass c;

    try {
        c = codeModel._class(name, ClassType.INTERFACE);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}
 
Example #27
Source File: BeanGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private ClassOutlineImpl generateClassDef(CClassInfo bean) {
    ImplStructureStrategy.Result r = model.strategy.createClasses(this, bean);
    JClass implRef;

    if (bean.getUserSpecifiedImplClass() != null) {
        // create a place holder for a user-specified class.
        JDefinedClass usr;
        try {
            usr = codeModel._class(bean.getUserSpecifiedImplClass());
            // but hide that file so that it won't be generated.
            usr.hide();
        } catch (JClassAlreadyExistsException e) {
            // it's OK for this to collide.
            usr = e.getExistingClass();
        }
        usr._extends(r.implementation);
        implRef = usr;
    } else {
        implRef = r.implementation;
    }

    return new ClassOutlineImpl(this, bean, r.exposed, r.implementation, implRef);
}
 
Example #28
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 #29
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 #30
Source File: BindInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** Gets the xjc:superClass customization if it's turned on. */
public JClass getSuperClass() {
    Element sc = DOMUtil.getElement(dom,XJC_NS,"superClass");
    if (sc == null) return null;

    JDefinedClass c;

    try {
        String v = DOMUtil.getAttribute(sc,"name");
        if(v==null)     return null;
        c = codeModel._class(v);
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}