Finds a field in the type or super type.

@param type  The type
@param name  The field name
@param value The value
488011
public static void setFieldIfPossible(Class type, String name, Object value) {
        Optional<Field> declaredField = findDeclaredField(type, name);
        if (declaredField.isPresent()) {
            Field field = declaredField.get();
            Optional<?> converted = ConversionService.SHARED.convert(value, field.getType());
            if (converted.isPresent()) {
                field.setAccessible(true);
                try {
                    field.set(type, converted.get());
                } catch (IllegalAccessException e) {
                    // ignore
                }
            } else {
                field.setAccessible(true);
                try {
                    field.set(type, null);
                } catch (IllegalAccessException e) {
                    // ignore
                }
            }
        }
    }
544791
public void setValue(ReloadableType rtype, Object newValue, String name) throws IllegalAccessException {
		if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINEST)) {
			log.finest("Static field set: " + rtype.getName() + "." + name + " " + newValue);
		}
		// TODO can setValue for static fields ignore interfaces? since we know all those fields will be final - what about the clinit calls to setup the fields though?
		FieldMember fieldmember = rtype.findStaticField(name);//InstanceField(name);

		if (fieldmember == null) {
			// If the field is null, there are two possible reasons:
			// 1. The field does not exist in the hierarchy at all
			// 2. The field is on a type just above our topmost reloadable type
			FieldReaderWriter frw = rtype.locateField(name);
			if (frw == null) {
				// bad code redeployed?
				log.info("Unexpectedly unable to locate static field " + name + " starting from type "
						+ rtype.dottedtypename
						+ ": clinit running late?");
				return;
			}
			frw.setStaticFieldValue(rtype.getClazz(), newValue, this);
		}
		else {
			if (!fieldmember.isStatic()) {
				throw new IncompatibleClassChangeError("Expected static field " + rtype.dottedtypename + "."
						+ fieldmember.getName());
			}
			Map<String, Object> typeValues = values.get(fieldmember.getDeclaringTypeName());//rtype.getName());
			if (typeValues == null) {
				typeValues = new HashMap<String, Object>();
				values.put(fieldmember.getDeclaringTypeName(), typeValues);
			}
			typeValues.put(name, newValue);
		}
	}
1162715
private void writeField(FieldType field, Object value) throws IOException
   {
      String fieldName = field.name().toLowerCase();
      writeField(fieldName, field.getDataType(), value);
   }
964524
protected AttributeConfig parseAttributeValue(String fieldType, String name, Object value) {
		value = parseValue(fieldType, value);
		if (value != null) {
			AttributeConfig attributeConfig = new AttributeConfig();
			attributeConfig.setName(name);
			attributeConfig.setValue(value.toString());
			return attributeConfig;
		}
		return null;
	}
160882
public static final boolean valueIsNotDefault(FieldType type, Object value)
   {
      boolean result = true;

      if (value == null)
      {
         result = false;
      }
      else
      {
         DataType dataType = type.getDataType();
         switch (dataType)
         {
            case BOOLEAN:
            {
               result = ((Boolean) value).booleanValue();
               break;
            }

            case CURRENCY:
            case NUMERIC:
            {
               result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001);
               break;
            }

            case DURATION:
            {
               result = (((Duration) value).getDuration() != 0);
               break;
            }

            default:
            {
               break;
            }
         }
      }

      return result;
   }
1097093
public FieldRefConstant addFieldRef(String className,
                                      String name,
                                      String type)
  {
    FieldRefConstant entry = getFieldRef(className, name, type);

    if (entry != null)
      return entry;

    ClassConstant classEntry = addClass(className);
    NameAndTypeConstant typeEntry = addNameAndType(name, type);

    entry = new FieldRefConstant(this, _entries.size(),
                                 classEntry.getIndex(),
                                 typeEntry.getIndex());

    addConstant(entry);

    return entry;
  }
297619
public static void setField(Class<?> type, String fieldName, Object fieldValue) {
		setField(null, type, fieldName, fieldValue);
	}
463194
public void addField(String fldName, Type type) {
		fields.put(fldName, type);
		if (myFieldSet != null)
			myFieldSet.add(fldName);
	}
1176755
public UserDefinedTypeBuilder withField(CqlIdentifier name, DataType type) {
    fieldNames.add(name);
    fieldTypes.add(type);
    return this;
  }
229426
public DiscriminatorJdbcSubBuilder when(String value, Type type) {
        return when(new DiscriminatorPredicate(value), type);
    }
78010
void selectFieldFacet(String field, String value) {

        m_selectedFieldFacets.clear();
        m_selectedRangeFacets.clear();
        m_selectedFieldFacets.put(field, Collections.singletonList(value));
        m_manager.search(m_selectedFieldFacets, m_selectedRangeFacets);
    }
397851
public void defineField(int modifier, String fieldName, Class<?> type)
    {
        defineField(modifier, fieldName, Typ.getTypeFor(type));
    }
575645
public TypeValuePairType getTypeValuePair(String type, String value) {
        return getTypeValuePair(type, value.getBytes(StandardCharsets.UTF_8));
    }
20722
private void set(FieldType field, boolean value)
   {
      set(field, (value ? Boolean.TRUE : Boolean.FALSE));
   }
949928
static Object getAdditionalFieldValue(String value, String fieldType) {

        Object result = null;
        if (fieldType.equalsIgnoreCase(FIELD_TYPE_DISCOVER)) {

            Result discoveredType = ValueDiscovery.discover(value);

            if (discoveredType == Result.STRING) {
                return value;
            }

            if (discoveredType == Result.LONG) {
                try {
                    // try adding the value as a long
                    return Long.parseLong(value);
                } catch (NumberFormatException ex) {
                    // fallback on the double value
                    return value;
                }
            }

            try {
                return Double.parseDouble(value);
            } catch (NumberFormatException ex) {
                // fallback on the string value
                return value;
            }
        }

        if (fieldType.equalsIgnoreCase(FIELD_TYPE_STRING)) {
            result = value;
        }

        if (fieldType.equals(FIELD_TYPE_DOUBLE) || fieldType.equalsIgnoreCase(FIELD_TYPE_DOUBLE2)) {
            try {
                result = Double.parseDouble(value);
            } catch (NumberFormatException ex) {
                if (fieldType.equals(FIELD_TYPE_DOUBLE)) {
                    result = Double.valueOf(0);
                }
            }
        }

        if (fieldType.equals(FIELD_TYPE_LONG) || fieldType.equalsIgnoreCase(FIELD_TYPE_LONG2)) {
            try {
                result = (long) Double.parseDouble(value);
            } catch (NumberFormatException ex) {
                if (fieldType.equals(FIELD_TYPE_LONG)) {
                    result = Long.valueOf(0);
                }
            }
        }

        return result;
    }
957711
@SuppressWarnings({ "unchecked", "rawtypes" })
	public static void setFieldValue(Object bean, String fieldNameOrIndex, Object value) {
		if (bean instanceof Map) {
			((Map) bean).put(fieldNameOrIndex, value);
		} else if (bean instanceof List) {
			CollUtil.setOrAppend((List) bean, Convert.toInt(fieldNameOrIndex), value);
		} else if (ArrayUtil.isArray(bean)) {
			ArrayUtil.setOrAppend(bean, Convert.toInt(fieldNameOrIndex), value);
		} else {
			// 普通Bean对象
			ReflectUtil.setFieldValue(bean, fieldNameOrIndex, value);
		}
	}
1066701
public boolean isCustomVariable(CobolPrimitiveType < ? > type, String name) {
        if (type.isCustomVariable()) {
            return true;
        }
        if (customVariables != null && customVariables.contains(name)) {
            return true;
        }
        if (customChoiceStrategy != null
                && customChoiceStrategy.getVariableNames() != null
                && customChoiceStrategy.getVariableNames().contains(name)) {
            return true;
        }
        return false;
    }