Package com.kenai.constantine

Examples of com.kenai.constantine.ConstantSet


*/
public final class Errno {
    private static final Collection<Constant> constants = getConstants();
   
    private static final Collection<Constant> getConstants() {
        ConstantSet c = ConstantSet.getConstantSet("Errno");
        if (c != null) {
            return c;
        }
        return getConstantsFromFields(IErrno.class);
    }
View Full Code Here


            // Recheck, in case another thread loaded the table
            if (cacheGuard != 0 && (c = cache[e.ordinal()]) != null) {
                return c;
            }
            EnumSet<E> enums = EnumSet.allOf(enumType);
            ConstantSet cset = getConstants();
            if (cache == null) {
                cache = new Constant[enums.size()];
            }
            long known = 0, unknown = 0;
            for (Enum v : enums) {
                c = cset.getConstant(v.name());
                if (c == null) {
                    if (bitmask) {
                        // Flag the value as unknown - real values will be
                        // inserted once all values are resolved, so there are
                        // no collisions
View Full Code Here

     * (e.g. EINVAL -> WSAEINVAL). We painstakenly map the missing constants to their WSA
     * equivalent values and expose the WSA constants on their own.
     */
    private static void initWindows(PyObject dict) {
        // the few POSIX errnos Windows defines
        ConstantSet winErrnos = ConstantSet.getConstantSet("Errno");
        // WSA errnos (and other Windows LastErrors)
        ConstantSet lastErrors = ConstantSet.getConstantSet("LastError");

        // Fill the gaps by searching through every possible constantine Errno first
        // checking if it's defined on Windows, then falling back to the WSA prefixed
        // version if it exists
        Constant constant;
        for (Constant errno : Errno.values()) {
            String errnoName = errno.name();
            if ((constant = winErrnos.getConstant(errnoName)) != null
                || (constant = lastErrors.getConstant("WSA" + errnoName)) != null) {
                addCode(dict, errnoName, constant.value(), constant.toString());
            }
        }
        // Then provide the WSA names
        for (Constant lastError : lastErrors) {
View Full Code Here

TOP

Related Classes of com.kenai.constantine.ConstantSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.