Not exactly the same as the executor's definition of get_field_def, in this
    statically evaluated environment we do not always have an Object type,
    and need to handle Interface and Union types.
328930
def get_field_def(
    schema,  # type: GraphQLSchema
    parent_type,  # type: Union[GraphQLInterfaceType, GraphQLObjectType]
    field_ast,  # type: Field
):
    # type: (...) -> Optional[GraphQLField]
    """"""
    name = field_ast.name.value
    if name == "__schema" and schema.get_query_type() == parent_type:
        return SchemaMetaFieldDef

    elif name == "__type" and schema.get_query_type() == parent_type:
        return TypeMetaFieldDef

    elif name == "__typename" and isinstance(
        parent_type, (GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType)
    ):
        return TypeNameMetaFieldDef

    elif isinstance(parent_type, (GraphQLObjectType, GraphQLInterfaceType)):
        return parent_type.fields.get(name)
821838
def get_prepopulated_value(field, instance):
    
    if hasattr(field.populate_from, '__call__'):
        # AutoSlugField(populate_from=lambda instance: ...)
        return field.populate_from(instance)
    else:
        # AutoSlugField(populate_from='foo')
        attr = getattr(instance, field.populate_from)
        return callable(attr) and attr() or attr
667107
public void getField(VariableElement field) throws IOException
    {
        if (field.getModifiers().contains(Modifier.STATIC))
        {
            throw new IllegalArgumentException(field+" is static");
        }
        int index = subClass.resolveFieldIndex(field);
        getfield(index);
    }
30076
private Object resolveReferenceValueOfField(FieldData field) {
        Object value = null;
        // Regardless of its path, the field references another resource.
        // fetch the field value (the path(s) to the referenced resource(s)) and resolve these resources.
        if (field.metaData.isCollectionType()) {
            String[] referencedResourcePaths = resolvePropertyTypedValue(field, String[].class);
            if (referencedResourcePaths != null) {
                value = createCollectionOfReferences(field, referencedResourcePaths);
            }
        } else {
            String referencedResourcePath = resolvePropertyTypedValue(field, String.class);
            if (referencedResourcePath != null) {
                if (field.metaData.isAppendPathPresentOnReference()) {
                    referencedResourcePath += field.metaData.getAppendPathOnReference();
                }
                value = resolveResource(referencedResourcePath, field.metaData.getType());
            }
        }
        return value;
    }
1126783
def get_field(self, field_name, args, kwargs):
        """"""
        try:
            obj, arg_used = super(FormatterWrapper, self).get_field(
                    field_name, args, kwargs)
        except (KeyError, IndexError, AttributeError):
            if not self.tolerant:
                raise

            obj = MissingField(field_name)
            arg_used = field_name

        return obj, arg_used
475552
private static Object generateValue(Field field) {
    Class<?> rawType = field.getType();

    //TODO Objects other than Lists might need parametrized types.
    if (List.class.isAssignableFrom(rawType)) {
      ParameterizedType genericType = (ParameterizedType) field.getGenericType();
      return createListObject(genericType);
    }

    return generateValue(rawType);
  }
433239
async def field(self, elem=None, elem_type=None, params=None, obj=None):
        
        elem_type = elem_type if elem_type else elem.__class__
        fvalue = None

        src = elem if self.writing else obj
        dst = obj if self.writing else elem

        # TODO: optional elem, default value for deserialization...

        # Blob wrapper. Underlying structure should be serialized as blob.
        if x.is_type(elem_type, BlobFieldWrapper):
            blobber = Blobber(self.writing, data=x.get_elem(src) if not self.writing else None)
            fvalue = await blobber.blobize(elem=x.get_elem(src), elem_type=elem_type.ftype, params=params)
            fvalue = NoSetSentinel() if fvalue is None or len(fvalue) == 0 else fvalue

        elif issubclass(elem_type, x.UVarintType):
            fvalue = await self.uvarint(x.get_elem(src))

        elif issubclass(elem_type, x.IntType):
            fvalue = await self.uint(elem=x.get_elem(src), elem_type=elem_type, params=params)

        elif issubclass(elem_type, x.BlobType):
            fvalue = await self.blob(elem=x.get_elem(src), elem_type=elem_type, params=params)

        elif issubclass(elem_type, x.UnicodeType):
            fvalue = await self.unicode_type(x.get_elem(src))

        elif issubclass(elem_type, x.VariantType):
            fvalue = await self.variant(elem=x.get_elem(src), elem_type=elem_type, params=params, obj=dst)

        elif issubclass(elem_type, x.ContainerType):  # container ~ simple list
            fvalue = await self.container(container=x.get_elem(src), container_type=elem_type, params=params, obj=dst)

        elif issubclass(elem_type, x.TupleType):  # tuple ~ simple list
            fvalue = await self.tuple(elem=x.get_elem(src), elem_type=elem_type, params=params, obj=dst)

        elif issubclass(elem_type, x.MessageType):
            fvalue = await self.message(x.get_elem(src), msg_type=elem_type, obj=dst)

        else:
            raise TypeError

        return x.set_elem(dst, fvalue) if not isinstance(fvalue, NoSetSentinel) else fvalue
403647
private CustomFieldDefinition getCustomFieldDefinitionType(JsonNode jn) throws IOException {
		if (jn.isArray()) {
			JsonNode jn1 = jn.get(0);
			String type = jn1.get(TYPE).textValue();
			try {
				return (CustomFieldDefinition) Class.forName("com.intuit.ipp.data." + type + "CustomFieldDefinition").newInstance();
			} catch (Exception e) {
				throw new IOException("Exception while deserializing CustomFieldDefinition", e);
			}
		}
		
		return null;
	}
1062755
private IDLProxyObject doSetFieldValue(String fullField, String field, Object value, Object object,
            boolean useCache, Map<String, ReflectInfo> cachedFields) {
        Field f;
        // check cache
        if (useCache) {
            ReflectInfo info = cachedFields.get(fullField);
            if (info != null) {
                setField(value, info.target, info.field);
                return this;
            }
        }

        int index = field.indexOf('.');
        if (index != -1) {
            String parent = field.substring(0, index);
            String sub = field.substring(index + 1);

            try {
                f = FieldUtils.findField(object.getClass(), parent);
                if (f == null) {
                    throw new RuntimeException(
                            "No field '" + parent + "' found at class " + object.getClass().getName());
                }
                Class<?> type = f.getType();
                f.setAccessible(true);
                Object o = f.get(object);
                if (o == null) {
                    boolean memberClass = type.isMemberClass();
                    if (memberClass && Modifier.isStatic(type.getModifiers())) {
                        Constructor<?> constructor = type.getConstructor(new Class[0]);
                        constructor.setAccessible(true);
                        o = constructor.newInstance(new Object[0]);
                    } else if (memberClass) {
                        Constructor<?> constructor = type.getConstructor(new Class[] { object.getClass() });
                        constructor.setAccessible(true);
                        o = constructor.newInstance(new Object[] { object });
                    } else {
                        o = type.newInstance();
                    }
                    f.set(object, o);
                }
                return put(fullField, sub, value, o);
            } catch (Exception e) {
                throw new RuntimeException(e.getMessage(), e);
            }
        }

        f = FieldUtils.findField(object.getClass(), field);
        if (f == null) {
            throw new RuntimeException("No field '" + field + "' found at class " + object.getClass().getName());
        }
        if (useCache && !cachedFields.containsKey(fullField)) {
            cachedFields.put(fullField, new ReflectInfo(f, object));
        }
        setField(value, object, f);

        return this;
    }
581516
private void computeDefaultSerializableFields(DocEnv env,
                                                  ClassSymbol def,
                                                  ClassDocImpl cd) {
        for (Scope.Entry e = def.members().elems; e != null; e = e.sibling) {
            if (e.sym != null && e.sym.kind == Kinds.VAR) {
                VarSymbol f = (VarSymbol)e.sym;
                if ((f.flags() & Flags.STATIC) == 0 &&
                    (f.flags() & Flags.TRANSIENT) == 0) {
                    //### No modifier filtering applied here.
                    FieldDocImpl fd = env.getFieldDoc(f);
                    //### Add to beginning.
                    //### Preserve order used by old 'javadoc'.
                    fields.prepend(fd);
                }
            }
        }
    }
900564
@Deprecated
    static void field(final Field field, final Object obj, final Object value) throws ReflectiveOperationException {
        if (!field.isAccessible()) {
            field.setAccessible(true);
        }
        final Class<?> type = field.getType();
        if (type.isPrimitive()) {
            if (value == null) {
                // @todo: WARN
                return;
            }
            if (type == boolean.class) {
                field.setBoolean(obj, (Boolean) value);
                return;
            }
            if (type == byte.class) {
                field.setByte(obj, (Byte) value);
                return;
            }
            if (type == char.class) {
                field.setChar(obj, (Character) value);
                return;
            }
            if (type == double.class) {
                field.setDouble(obj, (Double) value);
                return;
            }
            if (type == float.class) {
                field.setFloat(obj, (Float) value);
                return;
            }
            if (type == int.class) {
                field.setInt(obj, (Integer) value);
                return;
            }
            if (type == long.class) {
//                field.setLong(obj, (Long) value);
                if (value instanceof Number) {
                    field.setLong(obj, ((Number) value).longValue());
                    return;
                }
                return;
            }
            if (type == short.class) {
                if (value instanceof Number) {
                    field.setShort(obj, ((Number) value).shortValue());
                    return;
                }
            }
        }
        try {
            field.set(obj, value);
        } catch (final IllegalArgumentException iae) {
            if (type == Boolean.class) {
            }
            if (type == Byte.class) {
            }
            if (type == Short.class) {
                if (value instanceof Number) {
                    field.set(obj, ((Number) value).shortValue());
                    return;
                }
            }
            if (type == Integer.class) {
                if (value instanceof Number) {
                    field.set(obj, ((Number) value).intValue());
                    return;
                }
            }
            if (type == Long.class) {
            }
            if (type == Character.class) {
            }
            if (type == Float.class) {
            }
            if (type == Double.class) {
            }
            throw iae;
        }
    }
786538
def resolve_field_instance(cls_or_instance):
    
    if isinstance(cls_or_instance, type):
        if not issubclass(cls_or_instance, FieldABC):
            raise FieldInstanceResolutionError
        return cls_or_instance()
    else:
        if not isinstance(cls_or_instance, FieldABC):
            raise FieldInstanceResolutionError
        return cls_or_instance
648206
def _getattr (self, fieldname, raw=False, index=None):
        
        self._assertField(fieldname)
        value = None

        if fieldname == 'raw':
            value = createRawPacket(self)
        elif fieldname == 'history':
            value = self._defn.history
        else:
            if fieldname in self._defn.derivationmap:
                defn = self._defn.derivationmap[fieldname]
            else:
                defn = self._defn.fieldmap[fieldname]

            if isinstance(defn.type, dtype.ArrayType) and index is None:
                return createFieldList(self, defn, raw)

            if defn.when is None or defn.when.eval(self):
                if isinstance(defn, DerivationDefinition):
                    value = defn.equation.eval(self)
                elif raw or (defn.dntoeu is None and defn.expr is None):
                    value = defn.decode(self._data, raw, index)
                elif defn.dntoeu is not None:
                    value = defn.dntoeu.eval(self)
                elif defn.expr is not None:
                    value = defn.expr.eval(self)

        return value
268009
public static Type getParameterizedType(final Field field, final int index) {
        if (field != null) {
            if (field.getGenericType() instanceof ParameterizedType) {
                final ParameterizedType type = (ParameterizedType) field.getGenericType();
                if ((type.getActualTypeArguments() != null) && (type.getActualTypeArguments().length <= index)) {
                    return null;
                }
                final Type paramType = type.getActualTypeArguments()[index];
                if (paramType instanceof GenericArrayType) {
                    return paramType; //((GenericArrayType) paramType).getGenericComponentType();
                } else {
                    if (paramType instanceof ParameterizedType) {
                        return paramType;
                    } else {
                        if (paramType instanceof TypeVariable) {
                            // TODO: Figure out what to do... Walk back up the to
                            // the parent class and try to get the variable type
                            // from the T/V/X
                            // throw new MappingException("Generic Typed Class not supported:  <" + ((TypeVariable)
                            // paramType).getName() + "> = " + ((TypeVariable) paramType).getBounds()[0]);
                            return paramType;
                        } else if (paramType instanceof WildcardType) {
                            return paramType;
                        } else if (paramType instanceof Class) {
                            return paramType;
                        } else {
                            throw new MappingException("Unknown type... pretty bad... call for help, wave your hands... yeah!");
                        }
                    }
                }
            }

            // Not defined on field, but may be on class or super class...
            return getParameterizedClass(field.getType());
        }

        return null;
    }
845967
Field dereference(Field self, String field) {
    if (field.startsWith("[") && field.endsWith("]")) {
      field = field.substring(1, field.length() - 1);
    }

    Type type = protoTypeNames.get(self.type().toString());
    if (type instanceof MessageType) {
      MessageType messageType = (MessageType) type;
      Field messageField = messageType.field(field);
      if (messageField != null) return messageField;

      Map<String, Field> typeExtensions = messageType.extensionFieldsMap();
      Field extensionField = resolve(field, typeExtensions);
      if (extensionField != null) return extensionField;
    }

    return null; // Unable to traverse this field path.
  }
1005979
static JCExpression getFieldType(JavacNode field, FieldAccess fieldAccess) {
		if (field.getKind() == Kind.METHOD) return ((JCMethodDecl) field.get()).restype;
		
		boolean lookForGetter = lookForGetter(field, fieldAccess);
		
		GetterMethod getter = lookForGetter ? findGetter(field) : null;
		
		if (getter == null) {
			return ((JCVariableDecl) field.get()).vartype;
		}
		
		return getter.type;
	}
1071671
@Transactional
	public Object getField(ProcessInstance processInstance, FieldDescriptor fd) {
		Object o = getContextDAO().getContext(processInstance.getObjectInstance());
		String prefix="get";
		if (fd.getType().endsWith("Boolean")) {
			prefix="is";
		}
		String name=prefix+StringUtils.capitalize(fd.getName());
		try {
			Method getter = o.getClass().getMethod(name);
			return getter.invoke(o);
		} catch (Exception e) {
			throw new WorkflowException("Problem finding field: "+fd.getName());
		}
	}