Java Code Examples for com.sun.codemodel.internal.fmt.JStaticJavaFile#getJClass()

The following examples show how to use com.sun.codemodel.internal.fmt.JStaticJavaFile#getJClass() . 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: BeanGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public JClass generateStaticClass(Class src, JPackage out) {
    String shortName = getShortName(src.getName());

    // some people didn't like our jars to contain files with .java extension,
    // so when we build jars, we'' use ".java_". But when we run from the workspace,
    // we want the original source code to be used, so we check both here.
    // see bug 6211503.
    URL res = src.getResource(shortName + ".java");
    if (res == null) {
        res = src.getResource(shortName + ".java_");
    }
    if (res == null) {
        throw new InternalError("Unable to load source code of " + src.getName() + " as a resource");
    }

    JStaticJavaFile sjf = new JStaticJavaFile(out, shortName, res, null);
    out.addResourceFile(sjf);
    return sjf.getJClass();
}
 
Example 2
Source File: BeanGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public JClass generateStaticClass(Class src, JPackage out) {
    String shortName = getShortName(src.getName());

    // some people didn't like our jars to contain files with .java extension,
    // so when we build jars, we'' use ".java_". But when we run from the workspace,
    // we want the original source code to be used, so we check both here.
    // see bug 6211503.
    URL res = src.getResource(shortName + ".java");
    if (res == null) {
        res = src.getResource(shortName + ".java_");
    }
    if (res == null) {
        throw new InternalError("Unable to load source code of " + src.getName() + " as a resource");
    }

    JStaticJavaFile sjf = new JStaticJavaFile(out, shortName, res, null);
    out.addResourceFile(sjf);
    return sjf.getJClass();
}
 
Example 3
Source File: BeanGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public JClass generateStaticClass(Class src, JPackage out) {
    String shortName = getShortName(src.getName());

    // some people didn't like our jars to contain files with .java extension,
    // so when we build jars, we'' use ".java_". But when we run from the workspace,
    // we want the original source code to be used, so we check both here.
    // see bug 6211503.
    URL res = src.getResource(shortName + ".java");
    if (res == null) {
        res = src.getResource(shortName + ".java_");
    }
    if (res == null) {
        throw new InternalError("Unable to load source code of " + src.getName() + " as a resource");
    }

    JStaticJavaFile sjf = new JStaticJavaFile(out, shortName, res, null);
    out.addResourceFile(sjf);
    return sjf.getJClass();
}
 
Example 4
Source File: BeanGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public JClass generateStaticClass(Class src, JPackage out) {
    String shortName = getShortName(src.getName());

    // some people didn't like our jars to contain files with .java extension,
    // so when we build jars, we'' use ".java_". But when we run from the workspace,
    // we want the original source code to be used, so we check both here.
    // see bug 6211503.
    URL res = src.getResource(shortName + ".java");
    if (res == null) {
        res = src.getResource(shortName + ".java_");
    }
    if (res == null) {
        throw new InternalError("Unable to load source code of " + src.getName() + " as a resource");
    }

    JStaticJavaFile sjf = new JStaticJavaFile(out, shortName, res, null);
    out.addResourceFile(sjf);
    return sjf.getJClass();
}
 
Example 5
Source File: BeanGenerator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public JClass generateStaticClass(Class src, JPackage out) {
    String shortName = getShortName(src.getName());

    // some people didn't like our jars to contain files with .java extension,
    // so when we build jars, we'' use ".java_". But when we run from the workspace,
    // we want the original source code to be used, so we check both here.
    // see bug 6211503.
    URL res = src.getResource(shortName + ".java");
    if (res == null) {
        res = src.getResource(shortName + ".java_");
    }
    if (res == null) {
        throw new InternalError("Unable to load source code of " + src.getName() + " as a resource");
    }

    JStaticJavaFile sjf = new JStaticJavaFile(out, shortName, res, null);
    out.addResourceFile(sjf);
    return sjf.getJClass();
}
 
Example 6
Source File: BeanGenerator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public JClass generateStaticClass(Class src, JPackage out) {
    String shortName = getShortName(src.getName());

    // some people didn't like our jars to contain files with .java extension,
    // so when we build jars, we'' use ".java_". But when we run from the workspace,
    // we want the original source code to be used, so we check both here.
    // see bug 6211503.
    URL res = src.getResource(shortName + ".java");
    if (res == null) {
        res = src.getResource(shortName + ".java_");
    }
    if (res == null) {
        throw new InternalError("Unable to load source code of " + src.getName() + " as a resource");
    }

    JStaticJavaFile sjf = new JStaticJavaFile(out, shortName, res, null);
    out.addResourceFile(sjf);
    return sjf.getJClass();
}
 
Example 7
Source File: BeanGenerator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public JClass generateStaticClass(Class src, JPackage out) {
    String shortName = getShortName(src.getName());

    // some people didn't like our jars to contain files with .java extension,
    // so when we build jars, we'' use ".java_". But when we run from the workspace,
    // we want the original source code to be used, so we check both here.
    // see bug 6211503.
    URL res = src.getResource(shortName + ".java");
    if (res == null) {
        res = src.getResource(shortName + ".java_");
    }
    if (res == null) {
        throw new InternalError("Unable to load source code of " + src.getName() + " as a resource");
    }

    JStaticJavaFile sjf = new JStaticJavaFile(out, shortName, res, null);
    out.addResourceFile(sjf);
    return sjf.getJClass();
}
 
Example 8
Source File: BeanGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public JClass generateStaticClass(Class src, JPackage out) {
    JStaticJavaFile sjf = new JStaticJavaFile(out, getShortName(src), src, null);
    out.addResourceFile(sjf);
    return sjf.getJClass();
}