Java 类com.sun.codemodel.internal.ClassType 实例源码

项目:OpenJSharp    文件:BeanGenerator.java   
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
    JDefinedClass type;

    type = getClassFactory().createClass(
            getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
    type.javadoc().append(e.javadoc);

    return new EnumOutline(e, type) {

        @Override
        public
        @NotNull
        Outline parent() {
            return BeanGenerator.this;
        }
    };
}
项目:OpenJSharp    文件:BindInfo.java   
/** 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;
}
项目:openjdk-jdk10    文件:BeanGenerator.java   
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
    JDefinedClass type;

    type = getClassFactory().createClass(
            getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
    type.javadoc().append(e.javadoc);

    return new EnumOutline(e, type) {

        @Override
        public
        @NotNull
        Outline parent() {
            return BeanGenerator.this;
        }
    };
}
项目:openjdk-jdk10    文件:BindInfo.java   
/** 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;
}
项目:openjdk9    文件:BeanGenerator.java   
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
    JDefinedClass type;

    type = getClassFactory().createClass(
            getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
    type.javadoc().append(e.javadoc);

    return new EnumOutline(e, type) {

        @Override
        public
        @NotNull
        Outline parent() {
            return BeanGenerator.this;
        }
    };
}
项目:openjdk9    文件:BindInfo.java   
/** 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;
}
项目:lookaside_java-1.8.0-openjdk    文件:BeanGenerator.java   
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
    JDefinedClass type;

    type = getClassFactory().createClass(
            getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
    type.javadoc().append(e.javadoc);

    return new EnumOutline(e, type) {

        @Override
        public
        @NotNull
        Outline parent() {
            return BeanGenerator.this;
        }
    };
}
项目:lookaside_java-1.8.0-openjdk    文件:BindInfo.java   
/** 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;
}
项目:infobip-open-jdk-8    文件:BeanGenerator.java   
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
    JDefinedClass type;

    type = getClassFactory().createClass(
            getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
    type.javadoc().append(e.javadoc);

    return new EnumOutline(e, type) {

        @Override
        public
        @NotNull
        Outline parent() {
            return BeanGenerator.this;
        }
    };
}
项目:infobip-open-jdk-8    文件:BindInfo.java   
/** 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;
}
项目:OLD-OpenJDK8    文件:BeanGenerator.java   
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
    JDefinedClass type;

    type = getClassFactory().createClass(
            getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
    type.javadoc().append(e.javadoc);

    return new EnumOutline(e, type) {

        @Override
        public
        @NotNull
        Outline parent() {
            return BeanGenerator.this;
        }
    };
}
项目:OLD-OpenJDK8    文件:BindInfo.java   
/** 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;
}
项目:openjdk-icedtea7    文件:BeanGenerator.java   
/**
 * Generates the minimum {@link JDefinedClass} skeleton
 * without filling in its body.
 */
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
    JDefinedClass type;

    type = getClassFactory().createClass(
            getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
    type.javadoc().append(e.javadoc);

    return new EnumOutline(e, type) {

        @Override
        public
        @NotNull
        Outline parent() {
            return BeanGenerator.this;
        }
    };
}
项目:openjdk-icedtea7    文件:BindInfo.java   
/** 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;
}
项目:OpenJSharp    文件:GeneratorBase.java   
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
    JDefinedClass cls;
    try {
        cls = cm._class(className, type);
    } catch (JClassAlreadyExistsException e){
        cls = cm._getClass(className);
        if (cls == null) {
            throw e;
        }
    }
    return cls;
}
项目:OpenJSharp    文件:BIGlobalBinding.java   
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();
    }
}
项目:openjdk-jdk10    文件:BIGlobalBinding.java   
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();
    }
}
项目:openjdk-jdk10    文件:GeneratorBase.java   
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
    JDefinedClass cls;
    try {
        cls = cm._class(className, type);
    } catch (JClassAlreadyExistsException e){
        cls = cm._getClass(className);
        if (cls == null) {
            throw e;
        }
    }
    return cls;
}
项目:openjdk9    文件:BIGlobalBinding.java   
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();
    }
}
项目:openjdk9    文件:GeneratorBase.java   
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
    JDefinedClass cls;
    try {
        cls = cm._class(className, type);
    } catch (JClassAlreadyExistsException e){
        cls = cm._getClass(className);
        if (cls == null) {
            throw e;
        }
    }
    return cls;
}
项目:lookaside_java-1.8.0-openjdk    文件:GeneratorBase.java   
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
    JDefinedClass cls;
    try {
        cls = cm._class(className, type);
    } catch (JClassAlreadyExistsException e){
        cls = cm._getClass(className);
        if (cls == null) {
            throw e;
        }
    }
    return cls;
}
项目:lookaside_java-1.8.0-openjdk    文件:BIGlobalBinding.java   
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();
    }
}
项目:infobip-open-jdk-8    文件:GeneratorBase.java   
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
    JDefinedClass cls;
    try {
        cls = cm._class(className, type);
    } catch (JClassAlreadyExistsException e){
        cls = cm._getClass(className);
        if (cls == null) {
            throw e;
        }
    }
    return cls;
}
项目:infobip-open-jdk-8    文件:BIGlobalBinding.java   
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();
    }
}
项目:OLD-OpenJDK8    文件:GeneratorBase.java   
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
    JDefinedClass cls;
    try {
        cls = cm._class(className, type);
    } catch (JClassAlreadyExistsException e){
        cls = cm._getClass(className);
        if (cls == null) {
            throw e;
        }
    }
    return cls;
}
项目:OLD-OpenJDK8    文件:BIGlobalBinding.java   
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();
    }
}
项目:openjdk-icedtea7    文件:GeneratorBase.java   
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
    JDefinedClass cls;
    try {
        cls = cm._class(className, type);
    } catch (JClassAlreadyExistsException e){
        cls = cm._getClass(className);
        if(cls == null)
            throw e;
    }
    return cls;
}
项目:openjdk-icedtea7    文件:BIGlobalBinding.java   
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();
    }
}
项目:OpenJSharp    文件:CustomExceptionGenerator.java   
private void write(Fault fault) throws JClassAlreadyExistsException {
    String className = Names.customExceptionClassName(fault);

    JDefinedClass cls = cm._class(className, ClassType.CLASS);
    JDocComment comment = cls.javadoc();
    if(fault.getJavaDoc() != null){
        comment.add(fault.getJavaDoc());
        comment.add("\n\n");
    }

    for (String doc : getJAXWSClassComment()) {
        comment.add(doc);
    }

    cls._extends(java.lang.Exception.class);

    //@WebFault
    JAnnotationUse faultAnn = cls.annotate(WebFault.class);
    faultAnn.param("name", fault.getBlock().getName().getLocalPart());
    faultAnn.param("targetNamespace", fault.getBlock().getName().getNamespaceURI());

    JType faultBean = fault.getBlock().getType().getJavaType().getType().getType();

    //faultInfo filed
    JFieldVar fi = cls.field(JMod.PRIVATE, faultBean, "faultInfo");

    //add jaxb annotations
    fault.getBlock().getType().getJavaType().getType().annotate(fi);

    fi.javadoc().add("Java type that goes as soapenv:Fault detail element.");
    JFieldRef fr = JExpr.ref(JExpr._this(), fi);

    //Constructor
    JMethod constrc1 = cls.constructor(JMod.PUBLIC);
    JVar var1 = constrc1.param(String.class, "message");
    JVar var2 = constrc1.param(faultBean, "faultInfo");
    constrc1.javadoc().addParam(var1);
    constrc1.javadoc().addParam(var2);
    JBlock cb1 = constrc1.body();
    cb1.invoke("super").arg(var1);

    cb1.assign(fr, var2);

    //constructor with Throwable
    JMethod constrc2 = cls.constructor(JMod.PUBLIC);
    var1 = constrc2.param(String.class, "message");
    var2 = constrc2.param(faultBean, "faultInfo");
    JVar var3 = constrc2.param(Throwable.class, "cause");
    constrc2.javadoc().addParam(var1);
    constrc2.javadoc().addParam(var2);
    constrc2.javadoc().addParam(var3);
    JBlock cb2 = constrc2.body();
    cb2.invoke("super").arg(var1).arg(var3);
    cb2.assign(fr, var2);


    //getFaultInfo() method
    JMethod fim = cls.method(JMod.PUBLIC, faultBean, "getFaultInfo");
    fim.javadoc().addReturn().add("returns fault bean: "+faultBean.fullName());
    JBlock fib = fim.body();
    fib._return(fi);
    fault.setExceptionClass(cls);

}
项目:OpenJSharp    文件:BIGlobalBinding.java   
public JDefinedClass getSuperClass() {
    if(superClass==null)    return null;
    return superClass.getClazz(ClassType.CLASS);
}
项目:OpenJSharp    文件:BIGlobalBinding.java   
public JDefinedClass getSuperInterface() {
    if(superInterface==null)    return null;
    return superInterface.getClazz(ClassType.INTERFACE);
}
项目:OpenJSharp    文件:CodeModelClassFactory.java   
public JDefinedClass createClass( JClassContainer parent, int mod, String name, Locator source ) {
    return createClass(parent,mod,name,source,ClassType.CLASS);
}
项目:OpenJSharp    文件:CodeModelClassFactory.java   
public JDefinedClass createInterface( JClassContainer parent, int mod, String name, Locator source ) {
    return createClass(parent,mod,name,source,ClassType.INTERFACE);
}
项目:OpenJSharp    文件:CodeModelClassFactory.java   
public JDefinedClass createClass(
    JClassContainer parent, String name, Locator source, ClassType kind ) {
    return createClass(parent,JMod.PUBLIC,name,source,kind);
}
项目:OpenJSharp    文件:CodeModelClassFactory.java   
public JDefinedClass createClass(
    JClassContainer parent, int mod, String name, Locator source, ClassType kind ) {

    if(!JJavaName.isJavaIdentifier(name)) {
        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source ));
        return createDummyClass(parent);
    }


    try {
        if(parent.isClass() && kind==ClassType.CLASS)
            mod |= JMod.STATIC;

        JDefinedClass r = parent._class(mod,name,kind);
        // use the metadata field to store the source location,
        // so that we can report class name collision errors.
        r.metadata = source;

        return r;
    } catch( JClassAlreadyExistsException e ) {
        // class collision.
        JDefinedClass cls = e.getExistingClass();

        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
            (Locator)cls.metadata ));
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
            source ));

        if( !name.equals(cls.name()) ) {
            // on Windows, FooBar and Foobar causes name collision
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
                    name, cls.name() ), null ) );
        }

        if(Util.equals((Locator)cls.metadata,source)) {
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),
                source ));
        }

        return createDummyClass(parent);
    }
}
项目:openjdk-jdk10    文件:BIGlobalBinding.java   
public JDefinedClass getSuperClass() {
    if(superClass==null)    return null;
    return superClass.getClazz(ClassType.CLASS);
}
项目:openjdk-jdk10    文件:BIGlobalBinding.java   
public JDefinedClass getSuperInterface() {
    if(superInterface==null)    return null;
    return superInterface.getClazz(ClassType.INTERFACE);
}
项目:openjdk-jdk10    文件:CodeModelClassFactory.java   
public JDefinedClass createClass( JClassContainer parent, int mod, String name, Locator source ) {
    return createClass(parent,mod,name,source,ClassType.CLASS);
}
项目:openjdk-jdk10    文件:CodeModelClassFactory.java   
public JDefinedClass createInterface( JClassContainer parent, int mod, String name, Locator source ) {
    return createClass(parent,mod,name,source,ClassType.INTERFACE);
}
项目:openjdk-jdk10    文件:CodeModelClassFactory.java   
public JDefinedClass createClass(
    JClassContainer parent, String name, Locator source, ClassType kind ) {
    return createClass(parent,JMod.PUBLIC,name,source,kind);
}