Example usage for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants CLDC_1_1

List of usage examples for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants CLDC_1_1

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants CLDC_1_1.

Prototype

long CLDC_1_1

To view the source code for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants CLDC_1_1.

Click Source Link

Usage

From source file:org.hibernate.eclipse.console.workbench.ProjectCompilerVersionChecker.java

License:Open Source License

private static long versionToJdkLevel(Object versionID) {
    if (versionID instanceof String) {
        String version = (String) versionID;
        // verification is optimized for all versions with same length and same "1." prefix
        if (version.length() == 3 && version.charAt(0) == '1' && version.charAt(1) == '.') {
            switch (version.charAt(2)) {
            case '1':
                return ClassFileConstants.JDK1_1;
            case '2':
                return ClassFileConstants.JDK1_2;
            case '3':
                return ClassFileConstants.JDK1_3;
            case '4':
                return ClassFileConstants.JDK1_4;
            case '5':
                return ClassFileConstants.JDK1_5;
            case '6':
                return ClassFileConstants.JDK1_6;
            case '7':
                return ClassFileConstants.JDK1_7;
            case '8':
                return ClassFileConstants.JDK1_8;
            default:
                return 0; // unknown
            }//from   w w  w .j a va  2 s. c o  m
        }
        if (VERSION_JSR14.equals(versionID)) {
            return ClassFileConstants.JDK1_4;
        }
        if (VERSION_CLDC1_1.equals(versionID)) {
            return ClassFileConstants.CLDC_1_1;
        }
    }
    return 0; // unknown
}