public static Type valueOf(int value) {
        switch (value) {
          case 1: return TYPE_DOUBLE;
          case 2: return TYPE_FLOAT;
          case 3: return TYPE_INT64;
          case 4: return TYPE_UINT64;
          case 5: return TYPE_INT32;
          case 6: return TYPE_FIXED64;
          case 7: return TYPE_FIXED32;
          case 8: return TYPE_BOOL;
          case 9: return TYPE_STRING;
          case 10: return TYPE_GROUP;
          case 11: return TYPE_MESSAGE;
          case 12: return TYPE_BYTES;
          case 13: return TYPE_UINT32;
          case 14: return TYPE_ENUM;
          case 15: return TYPE_SFIXED32;
          case 16: return TYPE_SFIXED64;
          case 17: return TYPE_SINT32;
          case 18: return TYPE_SINT64;
          default: return null;
        }
      }