Parses the field.

@param <T> the generic type
@param input the input
@param extensionRegistry the extension registry
@param type the type
@param value the value
@return the t
@throws IOException Signals that an I/O exception has occurred.
962626
@SuppressWarnings("unchecked")
    static <T> T parseField(CodedInputStream input, ExtensionRegistryLite extensionRegistry, WireFormat.FieldType type,
            T value) throws IOException {
        switch (type) {
            case MESSAGE:
                int length = input.readRawVarint32();
                final int oldLimit = input.pushLimit(length);
                Codec<? extends Object> codec = ProtobufProxy.create(value.getClass());
                T ret = (T) codec.decode(input.readRawBytes(length));
                input.popLimit(oldLimit);
                return ret;
            case ENUM:
                return (T) (java.lang.Integer) input.readEnum();
            case GROUP:
                throw new RuntimeException("Groups are not allowed in maps.");
            default:
                return (T) CodedConstant.readPrimitiveField(input, type, true);
        }
    }
33034
public void specify(Type value) {
        if (value instanceof GenericArrayType) {
            this.specify = ((GenericArrayType) value).getGenericComponentType();
        } else if (value instanceof Class && ((Class) value).isArray()) {
            this.specify = ((Class) value).getComponentType();
        } else {
            this.specify = value;
        }
    }
164139
public static Object convertExample(String value, String type) {
        if (value == null) {
            return null;
        }

        try {
            switch (type) {
                case "integer":
                    return Integer.valueOf(value);
                case "number":
                    return Float.valueOf(value);
                case "boolean":
                    return Boolean.valueOf(value);
                case "string":
                    return value;
                default:
                    return value;
            }
        } catch (NumberFormatException e) {
            throw new RuntimeException(String.format("Value '%s' cannot be converted to '%s'", value, type), e);
        }
    }
1366535
public void add(final FieldDescriptor type, final Message defaultInstance) {
    if (type.getJavaType() != FieldDescriptor.JavaType.MESSAGE) {
      throw new IllegalArgumentException(
        "ExtensionRegistry.add() provided a default instance for a " +
        "non-message extension.");
    }
    add(new ExtensionInfo(type, defaultInstance));
  }
453766
void read(RecordInput rin, String tag) throws IOException {
    // number of elements
    int numElems = rin.readInt(tag);
    for (int i=0; i<numElems; i++) {
      typeInfos.add(genericReadTypeInfo(rin, tag));
    }
  }
530182
public static DynamicMessage parseFrom(Descriptor type, byte[] data,
                                         ExtensionRegistry extensionRegistry)
                                         throws InvalidProtocolBufferException {
    return newBuilder(type).mergeFrom(data, extensionRegistry).buildParsed();
  }
1061715
public void readGroup(final int fieldNumber,
                        final MessageLite.Builder builder,
                        final ExtensionRegistryLite extensionRegistry)
      throws IOException {
    if (recursionDepth >= recursionLimit) {
      throw InvalidProtocolBufferException.recursionLimitExceeded();
    }
    ++recursionDepth;
    builder.mergeFrom(this, extensionRegistry);
    checkLastTagWas(
      WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP));
    --recursionDepth;
  }
713021
private void initialize(InputStream input) {
		BufferedReader reader = null;

		try {
			reader = new BufferedReader(new InputStreamReader(input));

			String line;

			Matcher m;

			while ((line = reader.readLine()) != null) {
				m = TYPE_PATTERN.matcher(line);

				if (m.find()) {
					String type = m.group(1);
					String[] extensions = m.group(2).split(" ");

					for (String extension : extensions) {
						contentTypes.put(extension, type);
					}
				}
			}
		} catch (IOException e) {
			// Unable to load
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
325356
private FieldTypeInfo genericReadTypeInfo(RecordInput rin, String tag) throws IOException {
    String fieldName = rin.readString(tag);
    TypeID id = genericReadTypeID(rin, tag);
    return new FieldTypeInfo(fieldName, id);
  }
1351981
public <T extends Archive<T>> ArchiveFormat getArchiveFormatFromExtensionMapping(final Class<T> type) {
        ExtensionWrapper extensionWrapper = extensionMappings.get(type);
        if (extensionWrapper == null) {
            loadExtensionMapping(type);
        }
        extensionWrapper = extensionMappings.get(type);
        if (extensionWrapper == null) {
            throw UnknownExtensionTypeExceptionDelegator.newExceptionInstance(type);
        }
        String archiveFormat = extensionWrapper.getProperty("archiveFormat");
        return ArchiveFormat.valueOf(archiveFormat);
    }
1039388
def extension(self, value):
        

        if value is not None:
            assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                "extension", value)
        self.__extension = value
1016599
public <X> T value(X value, String subType) throws IOException {
		return text(stringifierFactory.toString(value, subType));
	}
668077
@Override
    <T> T parseRemaining(Class<T> declaredType) throws Exception {
        // the array and version has already been read
        overrideBasePackage = declaredType.getPackage().getName() + ".";
        // ref count + class map
        parseClassDescriptions();

        // parse
        Object parsed = parseObject(declaredType, null, null, null, true);
        return declaredType.cast(parsed);
    }
990177
public <T extends MessageLite> T readMessage(
      final Parser<T> parser,
      final ExtensionRegistryLite extensionRegistry)
      throws IOException {
    int length = readRawVarint32();
    if (recursionDepth >= recursionLimit) {
      throw InvalidProtocolBufferException.recursionLimitExceeded();
    }
    final int oldLimit = pushLimit(length);
    ++recursionDepth;
    T result = parser.parsePartialFrom(this, extensionRegistry);
    checkLastTagWas(0);
    --recursionDepth;
    popLimit(oldLimit);
    return result;
  }
1144816
private <T> T parseVersion(DataInputStream input, Class<T> declaredType) throws Exception {
        // root array
        int arrayByte = input.readByte();
        int versionByte = input.readByte();
        switch (versionByte) {
            case 1:
                if (arrayByte != MIN_FIX_ARRAY + 2) {
                    throw new IllegalArgumentException(
                            "Invalid binary data: Expected array with 2 elements, but was: 0x" + toHex(arrayByte));
                }
                return new JodaBeanStandardBinReader(settings, input).read(declaredType);
            case 2:
                if (arrayByte != MIN_FIX_ARRAY + 4) {
                    throw new IllegalArgumentException(
                            "Invalid binary data: Expected array with 4 elements, but was: 0x" + toHex(arrayByte));
                }
                return new JodaBeanReferencingBinReader(settings, input).read(declaredType);
            default:
                throw new IllegalArgumentException(
                        "Invalid binary data: Expected version 1 or 2, but was: 0x" + toHex(versionByte));
        }
    }
1138002
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        ObjectInputStream.GetField fields = in.readFields();
        String language = (String)fields.get("language", "");
        String script = (String)fields.get("script", "");
        String country = (String)fields.get("country", "");
        String variant = (String)fields.get("variant", "");
        String extStr = (String)fields.get("extensions", "");
        baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant);
        if (extStr != null && extStr.length() > 0) {
            try {
                InternalLocaleBuilder bldr = new InternalLocaleBuilder();
                bldr.setExtensions(extStr);
                localeExtensions = bldr.getLocaleExtensions();
            } catch (LocaleSyntaxException e) {
                throw new IllformedLocaleException(e.getMessage());
            }
        } else {
            localeExtensions = null;
        }
    }
1330044
def parse_interface_type_extension(lexer: Lexer) -> Node:
    """"""
    start = lexer.token
    expect_keyword(lexer, "extend")
    expect_keyword(lexer, "interface")
    name = parse_name(lexer)
    directives = parse_directives(lexer, True)
    fields = parse_fields_definition(lexer)
    if not (directives or fields):
        raise unexpected(lexer)
    return Node(
        name=name, directives=directives, fields=fields, loc=loc(lexer, start)
    )