Read a field. The field param must be a FieldDefinition and the context should be the record
 which is being read from.
771198
def read_attribute (field, context)
      if field.multivalued?
        arr = json_attributes[field.name]
        unless arr
          arr = EmbeddedDocumentArray.new(field.type, context)
          json_attributes[field.name] = arr
        end
        return arr
      else
        val = json_attributes[field.name]
        if val.nil? and !field.default.nil?
          val = field.default.dup rescue field.default
          json_attributes[field.name] = val
        end
        return val
      end
    end
940760
public BaseField readField(ObjectInputStream daIn, BaseField fldCurrent) throws IOException, ClassNotFoundException
    {
        String strFieldName = daIn.readUTF();
        Object objData = daIn.readObject();
        if (fldCurrent == null) if (strFieldName.length() > 0)
        {
        	fldCurrent = (BaseField)ClassServiceUtility.getClassService().makeObjectFromClassName(strFieldName);
        	if (fldCurrent != null)
        	{
                fldCurrent.init(null, null, DBConstants.DEFAULT_FIELD_LENGTH, null, null);
                if (this.getOwner() != null)    // Make sure it is cleaned up
                    this.getOwner().addListener(new RemoveConverterOnCloseHandler(fldCurrent));
        	}
        }
        if (fldCurrent != null)
            fldCurrent.setData(objData);
        return fldCurrent;
    }
1206918
public void read(long record, byte[] bytes) throws IOException {
        if (bytes.length != recordSize) {
            final String fmt = "invalid buffer length of %d bytes, expected %d";
            final String msg = format(fmt, bytes.length, recordSize);
            throw new InvalidArgument(msg);
        }

        // (+ recordSize) allows skipping metadata record
        long pos = record * recordSize + recordSize;

        if (pos >= size) {
            final String fmt = "bad seek to position: %d (size is %d)";
            final String msg = format(fmt, pos, size);
            throw new InvalidArgument(msg);
        }

        raf.seek(pos);
        int read = raf.read(bytes);

        if (read != recordSize) {
            final String fmt = "read %d bytes, but expected %d";
            final String msg = format(fmt, read, recordSize);
            throw new InvalidArgument(msg);
        }
    }
460559
private Object readKey(
          FieldDescriptor field,
          JsonParser parser,
          DeserializationContext context
  ) throws IOException {
    if (parser.getCurrentToken() != JsonToken.FIELD_NAME) {
      throw reportWrongToken(JsonToken.FIELD_NAME, context, "Expected FIELD_NAME token");
    }

    String fieldName = parser.getCurrentName();
    switch (field.getJavaType()) {
      case INT:
        // lifted from StdDeserializer since there's no method to call
        try {
          return NumberInput.parseInt(fieldName.trim());
        } catch (IllegalArgumentException iae) {
          Number number = (Number) context.handleWeirdStringValue(
                  _valueClass,
                  fieldName.trim(),
                  "not a valid int value"
          );
          return number == null ? 0 : number.intValue();
        }
      case LONG:
        // lifted from StdDeserializer since there's no method to call
        try {
          return NumberInput.parseLong(fieldName.trim());
        } catch (IllegalArgumentException iae) {
          Number number = (Number) context.handleWeirdStringValue(
                  _valueClass,
                  fieldName.trim(),
                  "not a valid long value"
          );
          return number == null ? 0L : number.longValue();
        }
      case BOOLEAN:
        // lifted from StdDeserializer since there's no method to call
        String text = fieldName.trim();
        if ("true".equals(text) || "True".equals(text)) {
          return true;
        }
        if ("false".equals(text) || "False".equals(text)) {
          return false;
        }
        Boolean b = (Boolean) context.handleWeirdStringValue(
                _valueClass,
                text,
                "only \"true\" or \"false\" recognized"
        );
        return Boolean.TRUE.equals(b);
      case STRING:
        return fieldName;
      case ENUM:
        EnumValueDescriptor enumValueDescriptor = field.getEnumType().findValueByName(parser.getText());

        if (enumValueDescriptor == null && !ignorableEnum(parser.getText().trim(), context)) {
          throw context.weirdStringException(parser.getText(), field.getEnumType().getClass(),
                  "value not one of declared Enum instance names");
        }

        return enumValueDescriptor;
      default:
        throw new IllegalArgumentException("Unexpected map key type: " + field.getJavaType());
    }
  }
821780
@Override
	public void addField(final SchemaField field) {

		if (field instanceof FieldDefinition) {
			addField((FieldDefinition) field);
		} else if (field instanceof CopyFieldDefinition) {
			addCopyField((CopyFieldDefinition) field);
		}
	}
507137
public void addFieldDefinition(FieldDefinition fieldDef) {
        // Assure field name is unique and add the definition to the map.
        Utils.require(!Utils.isEmpty(fieldDef.getName()), "Field name is required");
        Utils.require(!m_fieldDefMap.containsKey(fieldDef.getName()),
                      "Field names must be unique: " + fieldDef.getName());
        m_fieldDefMap.put(fieldDef.getName(), fieldDef);
        fieldDef.setTableDefinition(this);

        // Recurse to nested fields, if any.
        if (fieldDef.isGroupField()) {
            for (FieldDefinition nestedFieldDef : fieldDef.getNestedFields()) {
                addFieldDefinition(nestedFieldDef);
            }
        }
    }
979578
def parse_field(setting, field_name, default):
    
    if isinstance(setting, dict):
        return setting.get(field_name, default)
    else:
        return setting
682288
private void scanField(InputStream is)
    throws IOException
  {
    // int accessFlags = readShort();
    // int nameIndex = readShort();
    // int descriptorIndex = readShort();
    
    is.skip(6);

    int attributesCount = readShort(is);

    for (int i = 0; i < attributesCount; i++) {
      scanAttributeForAnnotation(is);
    }
  }
894079
def parse_fields_definition(lexer: Lexer) -> List[FieldDefinitionNode]:
    """"""
    return (
        cast(
            List[FieldDefinitionNode],
            many_nodes(
                lexer, TokenKind.BRACE_L, parse_field_definition, TokenKind.BRACE_R
            ),
        )
        if peek(lexer, TokenKind.BRACE_L)
        else []
    )
16115
private void determineFieldType(Field field) {
        // Determine the class of data stored in the field
        Class<?> fieldType = field.getType();

        isCollection = Collection.class.isAssignableFrom(fieldType);

        valueClass=null;
        if (!isCollection) {
            // It's not a list so assume its single valued - so just take the field type
            valueClass = fieldType;
        } else {
            determineCollectionClass(fieldType);
            // It's multi-valued - so we need to look at the signature in
            // the class file to find the generic type - this is supported for class file
            // format 49 and greater which corresponds to java 5 and later.
            ParameterizedType paramType;
            try {
                paramType = (ParameterizedType)field.getGenericType();
            } catch (ClassCastException e) {
                throw new MetaDataException(String.format("Can't determine destination type for field %1$s in Entry class %2$s", 
                        field, field.getDeclaringClass()), e);
            }
            Type[] actualParamArguments = paramType.getActualTypeArguments();
            if (actualParamArguments.length == 1) {
                if (actualParamArguments[0] instanceof Class) {
                    valueClass = (Class<?>)actualParamArguments[0];                    
                } else {
                    if (actualParamArguments[0] instanceof GenericArrayType) {
                        // Deal with arrays
                        Type type=((GenericArrayType)actualParamArguments[0]).getGenericComponentType();
                        if (type instanceof Class) {
                            valueClass=Array.newInstance((Class<?>)type, 0).getClass();
                        } 
                    } 
                }
            } 
        }

        // Check we have been able to determine the value class
        if (valueClass==null) {
            throw new MetaDataException(String.format("Can't determine destination type for field %1$s in class %2$s", 
                    field, field.getDeclaringClass()));
        }
    }
1056210
def read(cls, iprot):
        '''
        
        '''

        init_kwds = {}

        iprot.read_struct_begin()
        while True:
            ifield_name, ifield_type, _ifield_id = iprot.read_field_begin()
            if ifield_type == 0:  # STOP
                break
            elif ifield_name == 'detail_href':
                init_kwds['detail_href'] = iprot.read_string()
            elif ifield_name == 'record_type':
                init_kwds['record_type'] = iprot.read_string()
            elif ifield_name == 'title':
                init_kwds['title'] = iprot.read_string()
            elif ifield_name == 'thumbnail_url':
                try:
                    init_kwds['thumbnail_url'] = iprot.read_string()
                except (TypeError, ValueError,):
                    pass
            iprot.read_field_end()
        iprot.read_struct_end()

        return cls(**init_kwds)
459395
public BaseField getField(String strFieldName)    // Lookup this field
    {
        int iDotIndex = strFieldName.indexOf('.');
        if (iDotIndex != -1)    // Is Field formated as: RecordName.FieldName?
            return this.getField(strFieldName.substring(0, iDotIndex), strFieldName.substring(iDotIndex+1, strFieldName.length()));
        else
            return (BaseField)super.getField(strFieldName);
    }
48352
def parse_field(cls: Type[DocumentType], field_name: str, line: str) -> Any:
        
        try:
            match = cls.fields_parsers[field_name].match(line)
            if match is None:
                raise AttributeError
            value = match.group(1)
        except AttributeError:
            raise MalformedDocumentError(field_name)
        return value
864412
def get_field_list(fields, schema):
  
  # If the fields weren't supplied get them from the schema.
  if schema:
    all_fields = [f['name'] for f in schema._bq_schema if f['type'] != 'RECORD']

  if isinstance(fields, list):
    if schema:
      # validate fields exist
      for f in fields:
        if f not in all_fields:
          raise Exception('Cannot find field %s in given schema' % f)
    return fields
  if isinstance(fields, basestring) and fields != '*':
    if schema:
      # validate fields exist
      for f in fields.split(','):
        if f not in all_fields:
          raise Exception('Cannot find field %s in given schema' % f)
      return fields.split(',')
  if not schema:
    return []
  return all_fields
852885
def get_field_definition(field_definition):
    
    if not isinstance(field_definition, (tuple, list)):
        field_definition = [field_definition]
    else:
        field_definition = list(field_definition)

    if len(field_definition) == 1:
        field = [None, field_definition, None]
    elif len(field_definition) == 2:
        field = field_definition + [None]
    elif len(field_definition) == 3:
        field = field_definition
    else:
        raise ValueError("Invalid field definition format.")

    if not isinstance(field[1], (tuple, list)):
        field[1] = (field[1],)
    field[1] = tuple(name for name in field[1] if name is not None)

    return FieldDefinitionTuple(*field)
1111583
public static java.lang.reflect.Field read(ObjectInput in)
            throws ClassNotFoundException, NoSuchFieldException, IOException {
        Class cl;
        String name;

        cl = ClassRef.read(in);
        if (cl == null) {
            return null;
        } else {
            name = in.readUTF();
            return cl.getDeclaredField(name);
        }
    }
381416
private Object readField(final Field field, final Object obj) {
		try {
			return field.get(obj);
		} catch (IllegalAccessException e) {
			// Should not happen as we've called Field.setAccessible(true).
			LOG.error("Failed to read " + field.getName() + " of " + obj.getClass().getName(), e);
		}

		return null;
	}