包装字段名<br>
有时字段与SQL的某些关键字冲突，导致SQL出错，因此需要将字段名用单引号或者反引号包装起来，避免冲突
@param field 字段名
@return 包装后的字段名
502080
public String wrap(String field){
		if(preWrapQuote == null || sufWrapQuote == null || StrUtil.isBlank(field)) {
			return field;
		}
		
		//如果已经包含包装的引号，返回原字符
		if(StrUtil.isSurround(field, preWrapQuote, sufWrapQuote)){
			return field;
		}
		
		//如果字段中包含通配符或者括号（字段通配符或者函数），不做包装
		if(StrUtil.containsAnyIgnoreCase(field, "*", "(", " ", "as")) {
			return field;
		}
		
		//对于Oracle这类数据库，表名中包含用户名需要单独拆分包装
		if(field.contains(StrUtil.DOT)){
			final Collection<String> target = CollectionUtil.filter(StrUtil.split(field, StrUtil.C_DOT), new Editor<String>(){
				@Override
				public String edit(String t) {
					return StrUtil.format("{}{}{}", preWrapQuote, t, sufWrapQuote);
				}
			});
			return CollectionUtil.join(target, StrUtil.DOT);
		}
		
		return StrUtil.format("{}{}{}", preWrapQuote, field, sufWrapQuote);
	}
985473
public boolean removeField(String field) {
        HashMap map = fields;
        StringTokenizer tk = new StringTokenizer(field, ".");
        if (!tk.hasMoreTokens())
            return false;
        ArrayList hist = new ArrayList();
        while (true) {
            String s = tk.nextToken();
            Object obj = map.get(s);
            if (obj == null)
                return false;
            hist.add(map);
            hist.add(s);
            if (tk.hasMoreTokens()) {
                if (obj instanceof HashMap)
                    map = (HashMap)obj;
                else
                    return false;
            }
            else {
                if (obj instanceof HashMap)
                    return false;
                else
                    break;
            }
        }
        for (int k = hist.size() - 2; k >= 0; k -= 2) {
            map = (HashMap)hist.get(k);
            String s = (String)hist.get(k + 1);
            map.remove(s);
            if (!map.isEmpty())
                break;
        }
        return true;
    }
552919
public DOField getFieldByName(String fieldName) {
		int idx = this.getIndexOfField(fieldName);
		if (idx != -1)
			return this.getFieldByIndex(idx);
		return null;
	}
195785
public String getSQLColumn(String tabalis, String fieldname) {
        return this.aliasmap == null ? (tabalis == null ? fieldname : (tabalis + '.' + fieldname))
            : (tabalis == null ? aliasmap.getOrDefault(fieldname, fieldname) : (tabalis + '.' + aliasmap.getOrDefault(fieldname, fieldname)));
    }
1373957
public static String toStringPart(Field field) {
        String getterName;
        if (field.isMap()) {
            getterName = getMapGetterName(field);
        } else if (field.isRepeated()) {
            getterName = getRepeatedFieldGetterName(field);
        } else {
            getterName = getFieldGetterName(field);
        }
        if (field.getType().isEnum() && !field.isRepeated()) {
            return "\"" + getFieldName(field) + "=\" + " + getterName + "() + '(' + " + getEnumFieldValueGetterName(field) + "() + ')'";
        }
        return "\"" + getFieldName(field) + "=\" + " + getterName + "()";
    }
851999
@SuppressWarnings("rawtypes")
    private static Field getDeclaredField(Class clazz, String fieldName) throws NoSuchFieldException {
        Assert.notNull(clazz);
        Assert.hasText(fieldName);
        for (Class superClass = clazz; superClass != Object.class; superClass = superClass.getSuperclass()) {
            try {
                return superClass.getDeclaredField(fieldName);
            } catch (NoSuchFieldException e) {
                // Field不在当前类定义,继续向上转型
            }
        }
        throw new NoSuchFieldException("No such field: " + clazz.getName() + '.' + fieldName);
    }
234801
protected String getMappedFieldName(Field field, @Nullable Class<?> domainType) {
		return getMappedFieldName(field.getName(), domainType);
	}
1227709
private static Fields toFieldEnum(Field field) {
        Class<?> clazz = field.getType();
        String name = clazz.getSimpleName().toLowerCase();

        if (name.equals("int") || name.equals("integer")) {
            return Fields.INT;
        } else if (name.equals("long")) {
            return Fields.LONG;
        } else if (name.equals("float")) {
            return Fields.FLOAT;
        } else if (name.equals("double")) {
            return Fields.DOUBLE;
        } else if (CharSequence.class.isAssignableFrom(clazz)) {
            return Fields.STRING;
        } else if (name.equals("boolean")) {
            return Fields.BOOLEAN;
        } else if (clazz.isAssignableFrom(List.class)) {
            ParameterizedType listType = (ParameterizedType) field.getGenericType();
            Class<?> listClass = (Class<?>) listType.getActualTypeArguments()[0];

            if (listClass.toString().equals("class java.lang.String")) {
                return Fields.LIST;
            }
        }

        throw new RuntimeException("Field not found!");
    }
1205819
private List<String> getFieldPath(String field) {
        String[] paths = field.split("(?<!\\\\)\\.");
        ImmutableList.Builder<String> fields = ImmutableList.builder();
        for (String path : paths) {
            fields.add(path.replaceAll("\\\\\\.", ".").replaceAll("\\\\\\\\", "\\\\"));
        }
        return fields.build();
    }
692951
@SuppressWarnings("unchecked")
	public <T> T getOne(String field) {
		return (T) get(field).get(field);
	}
673199
public static String getFieldGetterName(Field field) {
        String getterName = GETTER_PREFIX + Formatter.toPascalCase(field.getName());
        if ("getClass".equals(getterName)) {
            return getterName + "_";
        }
        return getterName;
    }
651162
public ColumnMapper getMapper(String field) {
        String[] components = field.split("\\.");
        for (int i = components.length - 1; i >= 0; i--) {
            StringBuilder sb = new StringBuilder();
            for (int j = 0; j <= i; j++) {
                sb.append(components[j]);
                if (j < i) sb.append('.');
            }
            ColumnMapper columnMapper = columnMappers.get(sb.toString());
            if (columnMapper != null) return columnMapper;
        }
        return null;
    }
747588
function (field) {
      var ctr = this.constructor;
      var names = ctr.__names__;
      var constraints = ctr.__constraints__;
      if (typeof field === 'number') {
        if (field < 0 || field > names.length - 1) {
          throw new Error('Field index out of range: ' + field);
        }
        field = names[field];
      } else {
        if (!constraints.hasOwnProperty(field)) {
          throw new Error('Field name does not exist: ' + field);
        }
      }
      return this[field];
    }
321471
public static String getGenericString(Field field){
		
		String fieldDescription = field.toGenericString();
		List<String> splitResult = new ArrayList<String>();
		char[] charResult = fieldDescription.toCharArray();
		
		boolean isFinished = false;
		int separatorIndex = fieldDescription.indexOf(" ");
		int previousIndex = 0;
		
		while(!isFinished){
			
			// if previous character is "," don't cut the string
			int position = separatorIndex-1;
			char specialChar = charResult[position];
			boolean isSpecialChar = true;
			if(specialChar!=',' && specialChar != '?'){ 
				
				if(specialChar == 's'){
					String specialString = null;
					try{
						specialString = fieldDescription.substring(position - "extends".length(), position+1);
						if(isNull(specialString) || !" extends".equals(specialString))
							isSpecialChar = false;
					
					}catch(IndexOutOfBoundsException e){
						isSpecialChar = false;
					}
				
				}else
					isSpecialChar = false;
			}
			
			if(!isSpecialChar){
				splitResult.add(fieldDescription.substring(previousIndex, separatorIndex));
				previousIndex = separatorIndex+1;
			}
			
			separatorIndex = fieldDescription.indexOf(" ",separatorIndex+1);
			if(separatorIndex == -1)isFinished = true;
		}
		
		for (String description : splitResult)
			if(!isAccessModifier(description)) return description;
		
		return null;
	}
1309506
public <T> List<Entity> find(String field, T value) throws SQLException {
		return this.find(Entity.create(tableName).set(field, value));
	}
1164898
@SuppressWarnings("unchecked")
    public static <T extends Object> T getFieldValue(Object obj, Field field) {
        Assert.notNull(obj, "obj不能为空");
        Assert.notNull(field, "field不能为空");

        try {
            return (T) field.get(obj);
        } catch (IllegalArgumentException e) {
            throw new ReflectException(e);
        } catch (IllegalAccessException e) {
            String msg = StringUtils.format("类型[{0}]的字段[{1}]不允许访问", obj.getClass(),
                field.getName());
            log.error(msg);
            throw new ReflectException(msg, e);
        }
    }
1135897
public static String javaOneofConstantName(Field field) {
        String name = field.getName();
        String underscored = Formatter.toUnderscoreCase(name);
        return Formatter.toUpperCase(underscored);
    }