Converts a field/potential-constant into a ConstantField.
Returns null if the field cannot be constant.
Override this to change how fields are processed.
@param aClass the class the field came from
@param field the field
@return a ConstantField or null
426709
protected ConstantField processField(Class<?> aClass, Field field) {
        Constant annot = field.getAnnotation(Constant.class);
        if (annot != null) {
            return factory.createConstantField(aClass, field.getName(), annot);
        }

        return null;
    }
374675
public static Class getFieldType(FieldNode field) {
        // Step 1: Analyze the field's declared type
        Class declaredType = getClassForClassNode(field.getType());
        if (declaredType != null) {
            return declaredType;
        }

        // Step 2: Analyze the cast type of the initial expression
        if (field.getInitialExpression() != null) {
            Class castType = getClassForClassNode(field.getInitialExpression().getType());
            if (castType != null) {
                return castType;
            }
        }

        // Step 3: Look at the literal within the constant
        if (field.getInitialExpression() instanceof ConstantExpression) {
            Object constantValue = ((ConstantExpression) field.getInitialExpression()).getValue();
            if (constantValue == null) {
                return null;
            } else if (constantValue instanceof String) {
                return String.class;
            } else if (isBoolean(field.getInitialExpression())) {
                return Boolean.class;
            } else if (constantValue.getClass() == Integer.class || constantValue.getClass() == Integer.TYPE) {
                return Integer.class;
            } else if (constantValue.getClass() == Long.class || constantValue.getClass() == Long.TYPE) {
                return Long.class;
            } else if (constantValue.getClass() == Double.class || constantValue.getClass() == Double.TYPE) {
                return Double.class;
            } else if (constantValue.getClass() == Float.class || constantValue.getClass() == Float.TYPE) {
                return Float.class;
            }
        }
        return null;
    }
333508
public Class<?> getActualFieldType(final String field) {
        
        final Object fieldValue = getFieldValue(field);
        return fieldValue == null ? null : fieldValue.getClass();
        
    }
536623
public static Class<?> getGenericFieldType(Field field) {
        ParameterizedType stringListType = (ParameterizedType) field.getGenericType();
        Class<?> clazz = (Class<?>) stringListType.getActualTypeArguments()[0];
        return clazz;
	}
780373
@Override
   protected String resolveField(Field field)
   {
      final String fallBackName = field.getName();
      final String resourceName = field.getAnnotation(Resource.class).name();

      return getName(resourceName, fallBackName);
   }
200662
public static XField createXField(String className, Field field) {
        String fieldName = field.getName();
        String fieldSig = field.getSignature();

        XField xfield = getExactXField(className, fieldName, fieldSig, field.isStatic());
        assert xfield.isResolved() : "Could not exactly resolve " + xfield;
        return xfield;
    }
850394
public Class<?> getFieldType(final String field) {
        
        final String fieldPath = buildFieldPath(field);
        Class<?> type = propertyTypeNavigator.getPropertyType(target.getClass(), fieldPath);
        if(type != null) {
            return type;
        }
        
        return getActualFieldType(fieldPath);
    }
1248694
public static final <C> AsmFieldAccess<C> get(AsmClassAccess<C> classAccess, Field f) {
		return new AsmFieldAccess<C>(classAccess, f);
	}
27293
private static Field getField(final Class cls, final String fieldName, boolean declared) {
		$.checkNotEmpty(fieldName);
		List<Field> fields = getFieldsList(cls, declared);
		for (int i = 0; i < fields.size(); i++) {
			if (fieldName.equals(fields.get(i).getName())) {
				return fields.get(i);
			}
		}
		return null;
	}
689472
@SuppressWarnings("unchecked")
    public <A extends Annotation> A getAnnotation(final Field field, final Class<A> annClass) throws AnnotationReadException {
        
        final Class<?> clazz = field.getDeclaringClass();
        
        if(xmlInfo != null && xmlInfo.containsClassInfo(clazz.getName())) {
            final ClassInfo classInfo = xmlInfo.getClassInfo(clazz.getName());
            
            if(classInfo.containsFieldInfo(field.getName())) {
                FieldInfo fieldInfo = classInfo.getFieldInfo(field.getName());
                if(fieldInfo != null && fieldInfo.containsAnnotationInfo(annClass.getName())){
                    AnnotationInfo annInfo = fieldInfo.getAnnotationInfo(annClass.getName());
                    try {
                        return (A)annotationBuilder.buildAnnotation(Class.forName(annInfo.getClassName()), annInfo);
                    } catch (ClassNotFoundException e) {
                        throw new AnnotationReadException(String.format("not found class '%s'", annInfo.getClassName()), e);
                    }
                }
            }
        }
        return field.getAnnotation(annClass);
    }
528893
public static Field getField(Class clazz, String fieldName)
    {
        try
        {
            return clazz.getField(fieldName);
        }
        catch (Exception ignored)
        {}
        return null;
    }
898729
public static Field getField(String fieldName, Class<?> clazz) {
    Field field = null;
    try {
      field = clazz.getDeclaredField(fieldName);
    }
    catch (SecurityException e) {
      throw LOG.unableToAccessField(field, clazz.getName());
    }
    catch (NoSuchFieldException e) {
      // for some reason getDeclaredFields doesnt search superclasses
      // (which getFields() does ... but that gives only public fields)
      Class<?> superClass = clazz.getSuperclass();
      if (superClass != null) {
        return getField(fieldName, superClass);
      }
    }
    return field;
  }
1144667
public static FieldInfo of(Field field) {
    if (field == null) {
      return null;
    }
    synchronized (CACHE) {
      FieldInfo fieldInfo = CACHE.get(field);
      boolean isEnumContant = field.isEnumConstant();
      if (fieldInfo == null && (isEnumContant || !Modifier.isStatic(field.getModifiers()))) {
        String fieldName;
        if (isEnumContant) {
          // check for @Value annotation
          Value value = field.getAnnotation(Value.class);
          if (value != null) {
            fieldName = value.value();
          } else {
            // check for @NullValue annotation
            NullValue nullValue = field.getAnnotation(NullValue.class);
            if (nullValue != null) {
              fieldName = null;
            } else {
              // else ignore
              return null;
            }
          }
        } else {
          // check for @Key annotation
          Key key = field.getAnnotation(Key.class);
          if (key == null) {
            // else ignore
            return null;
          }
          fieldName = key.value();
          field.setAccessible(true);
        }
        if ("##default".equals(fieldName)) {
          fieldName = field.getName();
        }
        fieldInfo = new FieldInfo(field, fieldName);
        CACHE.put(field, fieldInfo);
      }
      return fieldInfo;
    }
  }
329472
public static Type getType(Field field) {
		if (null == field) {
			return null;
		}
		Type type = field.getGenericType();
		if (null == type) {
			type = field.getType();
		}
		return type;
	}
532051
static Field getDeclaredField(final Class<?> c, final String name)
      throws NoSuchFieldException
   {
      if (System.getSecurityManager() == null)
         return c.getDeclaredField(name);

      Field result = AccessController.doPrivileged(new PrivilegedAction<Field>()
      {
         public Field run()
         {
            try
            {
               return c.getDeclaredField(name);
            }
            catch (NoSuchFieldException e)
            {
               return null;
            }
         }
      });

      if (result != null)
         return result;

      throw new NoSuchFieldException();
   }
1198612
@Nullable
  public Object get(@Nonnull String field) {
    return get(FieldPath.fromDotSeparatedString(field));
  }
129310
private static Object getFieldValue(final Object classInstance, final Field classField) {
    try {
      return classField.get(classInstance);
    } catch (IllegalArgumentException ex) {
      throw new JBBPMapperException("Can't set get value from a mapping field", null, classInstance.getClass(), classField, ex);
    } catch (IllegalAccessException ex) {
      throw new JBBPMapperException("Can't get access to a mapping field", null, classInstance.getClass(), classField, ex);
    }
  }