获取给定Bean列表中指定字段名对应字段值的列表<br>
列表元素支持Bean与Map

@param collection Bean集合或Map集合
@param fieldName 字段名或map的键
@return 字段值列表
@since 3.1.0
512165
public static List<Object> getFieldValues(Iterable<?> collection, final String fieldName) {
		return getFieldValues(collection, fieldName, false);
	}
9381
public Entity setFieldNames(String... fieldNames) {
		if (ArrayUtil.isNotEmpty(fieldNames)) {
			this.fieldNames = CollectionUtil.newHashSet(fieldNames);
		}
		return this;
	}
630927
@SuppressWarnings("unchecked")
	public <T> T get(String fieldName) throws BeanException{
		if(Map.class.isAssignableFrom(beanClass)){
			return (T) ((Map<?, ?>)bean).get(fieldName);
		}else{
			try {
				final Method method = BeanUtil.getBeanDesc(beanClass).getGetter(fieldName);
				if(null == method){
					throw new BeanException("No get method for {}", fieldName);
				}
				return (T) method.invoke(this.bean);
			} catch (Exception e) {
				throw new BeanException(e);
			}
		}
	}
192819
@Override
    public Optional<FieldTypes> get(final String fieldName) {
        return Optional.ofNullable(get(ImmutableSet.of(fieldName)).get(fieldName));
    }
144308
public <R, RK> List<R> fetch(Collection<DBRef<R, RK>> collection, DBObject fields) {
        Map<JacksonCollectionKey, List<Object>> collectionsToIds = new HashMap<JacksonCollectionKey, List<Object>>();
        for (DBRef<R, RK> ref : collection) {
            if (ref instanceof FetchableDBRef) {
                JacksonCollectionKey key = ((FetchableDBRef) ref).getCollectionKey();
                List<Object> ids = collectionsToIds.get(key);
                if (ids == null) {
                    ids = new ArrayList<Object>();
                    collectionsToIds.put(key, ids);
                }
                ids.add(getReferenceCollection(key).convertToDbId(ref.getId()));
            }
        }
        List<R> results = new ArrayList<R>();
        for (Map.Entry<JacksonCollectionKey, List<Object>> entry : collectionsToIds.entrySet()) {
            for (R result : this.<R, RK>getReferenceCollection(entry.getKey()).find(
                    new QueryBuilder().put("_id").in(entry.getValue()).get(), fields)) {
                results.add(result);
            }
        }
        return results;
    }
760613
List<MapOnly> getMapOnlies(Field field) {
        List<MapOnly> mapOnly = reflectionHelper.getAnnotationWithMeta(field, MapOnly.class);
        List<MapOnlies> mapOnlies = reflectionHelper.getAnnotationWithMeta(field, MapOnlies.class);
        if (0 == mapOnly.size() && 0 == mapOnlies.size()) {
            return null;
        }
        List<MapOnly> res = new ArrayList<>();
        res.addAll(mapOnly);
        mapOnlies.forEach(mo -> Collections.addAll(res, mo.value()));
        return res;
    }
31219
public Optional<FieldTypes.Type> mapType(String typeName) {
        return Optional.ofNullable(TYPE_MAP.get(typeName));
    }
578483
public CollectionComposer<MapComposer<PARENT>,?> startArrayField(String fieldName)
    {
        _closeChild();
        _fieldName = fieldName;
        CollectionComposer<MapComposer<PARENT>,?> child = _startCollection(this);
        _map.put(fieldName, child._collection);
        return child;
    }
856142
public boolean containsFieldName(String field) {
    for (SortElement e : elements) {
      if (e.getName().equals(field)) {
        return true;
      }
    }
    return false;
  }
946429
public static Collection beanMap(String property, Collection c) {
        return beanMap(property, c.iterator(), false);
    }
1149031
private Optional<MapPositionSetter> createMapField(final Class<?> beanClass, final String fieldName) {
        
        final Field positionsField;
        try {
            positionsField = beanClass.getDeclaredField("positions");
            positionsField.setAccessible(true);
            
        } catch (NoSuchFieldException | SecurityException e) {
            // フィールドが見つからない場合は、何もしない。
            return Optional.empty();
        }
        
        if(!Map.class.isAssignableFrom(positionsField.getType())) {
            return Optional.empty();
        }
        
        final ParameterizedType type = (ParameterizedType) positionsField.getGenericType();
        final Class<?> keyType = (Class<?>) type.getActualTypeArguments()[0];
        final Class<?> valueType = (Class<?>) type.getActualTypeArguments()[1];
        
        if(keyType.equals(String.class) && valueType.equals(CellPosition.class)) {
            return Optional.of(new MapPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final String key) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                    try {
                        Map<String, CellPosition> positionsMapObj = (Map<String, CellPosition>) positionsField.get(beanObj);
                        if(positionsMapObj == null) {
                            positionsMapObj = new LinkedHashMap<>();
                            positionsField.set(beanObj, positionsMapObj);
                        }
                        
                        final String mapKey = createMapKey(fieldName, key);
                        
                        positionsMapObj.put(mapKey, position);
                        
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access positions field.", e);
                    }
                }
            });
            
        } else if(keyType.equals(String.class) && valueType.equals(Point.class)) {
            
            return Optional.of(new MapPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final String key) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                    try {
                        Map<String, Point> positionsMapObj = (Map<String, Point>) positionsField.get(beanObj);
                        if(positionsMapObj == null) {
                            positionsMapObj = new LinkedHashMap<>();
                            positionsField.set(beanObj, positionsMapObj);
                        }
                        
                        final String mapKey = createMapKey(fieldName, key);
                        positionsMapObj.put(mapKey, position.toPoint());
                        
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access positions field.", e);
                    }
                }
            });
            
            
        } else if(keyType.equals(String.class) && valueType.equals(CellAddress.class)) {
            
            return Optional.of(new MapPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final String key) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                    try {
                        Map<String, CellAddress> positionsMapObj = (Map<String, CellAddress>) positionsField.get(beanObj);
                        if(positionsMapObj == null) {
                            positionsMapObj = new LinkedHashMap<>();
                            positionsField.set(beanObj, positionsMapObj);
                        }
                        
                        final String mapKey = createMapKey(fieldName, key);
                        positionsMapObj.put(mapKey, position.toCellAddress());
                        
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access positions field.", e);
                    }
                }
            });
            
            
        } else {
            // タイプが一致しない場合
            log.warn("not match generics type of positions. key type:{}, value type:{}.", keyType.getName(), valueType.getName());
            return Optional.empty();
        }
        
    }
1135572
private Optional<ArrayLabelSetter> createMapField(final Class<?> beanClass, final String fieldName) {
        
        final Field labelsField;
        try {
            labelsField = beanClass.getDeclaredField("labels");
            labelsField.setAccessible(true);
            
        } catch (NoSuchFieldException | SecurityException e) {
            // フィールドが見つからない場合は、何もしない。
            return Optional.empty();
        }
        
        if(!Map.class.isAssignableFrom(labelsField.getType())) {
            return Optional.empty();
        }
        
        final ParameterizedType type = (ParameterizedType) labelsField.getGenericType();
        final Class<?> keyType = (Class<?>) type.getActualTypeArguments()[0];
        final Class<?> valueType = (Class<?>) type.getActualTypeArguments()[1];
        
        if(keyType.equals(String.class) && valueType.equals(String.class)) {
            return Optional.of(new ArrayLabelSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final String label, final int index) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notEmpty(label, "label");
                    
                    try {
                        Map<String, String> labelsMapObj = (Map<String, String>) labelsField.get(beanObj);
                        if(labelsMapObj == null) {
                            labelsMapObj = new LinkedHashMap<>();
                            labelsField.set(beanObj, labelsMapObj);
                        }
                        
                        final String mapKey = createMapKey(fieldName, index);
                        
                        labelsMapObj.put(mapKey, label);
                        
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access labels field.", e);
                    }
                }
            });
            
        } else {
            // タイプが一致しない場合
            log.warn("not match generics type of labels. key type:{}, value type:{}.", keyType.getName(), valueType.getName());
            return Optional.empty();
        }
        
    }
136609
@Nullable
	private FieldAnnotation getFieldAnnotation(final String fieldName) {
		JavaClass cls = getClassContext().getJavaClass();
		Field[] fields = cls.getFields();
		for (Field f : fields) {
			if (f.getName().equals(fieldName)) {
				return new FieldAnnotation(cls.getClassName(), fieldName, f.getSignature(), f.isStatic());
			}
		}
		return null; // shouldn't happen
	}
1258402
private Map<String, TField> computeFieldNameMap(Class<?> clazz) {
        final Map<String, TField> map = new HashMap<>();

        if (isTBase(clazz)) {
            // Get the metaDataMap for this Thrift class
            @SuppressWarnings("unchecked")
            final Map<? extends TFieldIdEnum, FieldMetaData> metaDataMap =
                    FieldMetaData.getStructMetaDataMap((Class<? extends TBase<?, ?>>) clazz);

            for (Entry<? extends TFieldIdEnum, FieldMetaData> e : metaDataMap.entrySet()) {
                final String fieldName = e.getKey().getFieldName();
                final FieldMetaData metaData = e.getValue();

                final FieldValueMetaData elementMetaData;
                if (metaData.valueMetaData.isContainer()) {
                    if (metaData.valueMetaData instanceof SetMetaData) {
                        elementMetaData = ((SetMetaData) metaData.valueMetaData).elemMetaData;
                    } else if (metaData.valueMetaData instanceof ListMetaData) {
                        elementMetaData = ((ListMetaData) metaData.valueMetaData).elemMetaData;
                    } else if (metaData.valueMetaData instanceof MapMetaData) {
                        elementMetaData = ((MapMetaData) metaData.valueMetaData).valueMetaData;
                    } else {
                        // Unrecognized container type, but let's still continue processing without
                        // special enum support.
                        elementMetaData = metaData.valueMetaData;
                    }
                } else {
                    elementMetaData = metaData.valueMetaData;
                }

                if (elementMetaData instanceof EnumMetaData) {
                    classMap.put(fieldName, ((EnumMetaData) elementMetaData).enumClass);
                } else if (elementMetaData instanceof StructMetaData) {
                    classMap.put(fieldName, ((StructMetaData) elementMetaData).structClass);
                }

                // Workaround a bug in the generated thrift message read()
                // method by mapping the ENUM type to the INT32 type
                // The thrift generated parsing code requires that, when expecting
                // a value of enum, we actually parse a value of type int32. The
                // generated read() method then looks up the enum value in a map.
                final byte type = TType.ENUM == metaData.valueMetaData.type ? TType.I32
                                                                            : metaData.valueMetaData.type;

                map.put(fieldName,
                        new TField(fieldName,
                                   type,
                                   e.getKey().getThriftFieldId()));
            }
        } else { // TApplicationException
            map.put("message", new TField("message", (byte)11, (short)1));
            map.put("type", new TField("type", (byte)8, (short)2));
        }

        return map;
    }
431702
public boolean isField(final String fieldName) {
    if (fieldName != null) {
        return (KEYWORD_LIST.contains(
                fieldName.toUpperCase(Locale.US))
                || fieldName.toUpperCase().startsWith(PROP_FIELD));
    }
    return false;
  }
1321888
public Field[] getFields(Class clazz, String fieldname) {
	Struct fieldMap;
	Object o;
	synchronized (map) {
	    o = map.get(clazz);
	    if (o == null) {
		fieldMap = store(clazz);
	    }
	    else fieldMap = (Struct) o;
	}
	o = fieldMap.get(fieldname, null);
	if (o == null) return null;
	return (Field[]) o;

    }
787959
@SuppressWarnings("unchecked")
	public static <K, V> Map<K, V> fieldValueAsMap(Iterator<?> iter, String fieldNameForKey, String fieldNameForValue) {
		final Map<K, V> result = new HashMap<>();
		if (null != iter) {
			Object value;
			while (iter.hasNext()) {
				value = iter.next();
				result.put((K) ReflectUtil.getFieldValue(value, fieldNameForKey), (V) ReflectUtil.getFieldValue(value, fieldNameForValue));
			}
		}
		return result;
	}