private Class<?> resolveClass(int id)
    {
        final int type = id & 0x1F;
        if (type < 16)
        {
            final boolean primitive = type < 8;
            // first 3 bits
            switch (type & 0x07)
            {
                case CID_BOOL:
                    return primitive ? boolean.class : Boolean.class;
                case CID_BYTE:
                    return primitive ? byte.class : Byte.class;
                case CID_CHAR:
                    return primitive ? char.class : Character.class;
                case CID_SHORT:
                    return primitive ? short.class : Short.class;
                case CID_INT32:
                    return primitive ? int.class : Integer.class;
                case CID_INT64:
                    return primitive ? long.class : Long.class;
                case CID_FLOAT:
                    return primitive ? float.class : Float.class;
                case CID_DOUBLE:
                    return primitive ? double.class : Double.class;
                default:
                    throw new RuntimeException("Should not happen.");
            }
        }

        switch (type)
        {
            case CID_STRING:
                return String.class;
            case CID_BYTES:
                return ByteString.class;
            case CID_BYTE_ARRAY:
                return byte[].class;
            case CID_BIGDECIMAL:
                return BigDecimal.class;
            case CID_BIGINTEGER:
                return BigInteger.class;
            case CID_DATE:
                return Date.class;
            case CID_OBJECT:
                return Object.class;
            case CID_ENUM_SET:
                return EnumSet.class;
            case CID_ENUM_MAP:
                return EnumMap.class;
            case CID_ENUM:
                return enumClass(id >>> 5);

            case CID_COLLECTION:
                return collectionClass(id >>> 5);

            case CID_MAP:
                return mapClass(id >>> 5);

            case CID_POJO:
                return pojoClass(id >>> 5);

            case CID_CLASS:
                return Class.class;

            case CID_DELEGATE:
                return delegateClass(id >>> 5);
        }

        throw new RuntimeException("Should not happen.");
    }
Base class for numeric id strategies.

@author David Yu
@created Mar 28, 2012
protostuff-runtime-registry/src/main/java/io/protostuff/runtime/NumericIdStrategy.java