Gets a collection of all known values to an expandable string enum type.
@param clazz the class of the expandable string enum
@param <T> the class of the expandable string enum
@return a collection of all known values
173793
@SuppressWarnings("unchecked")
    protected static <T extends ExpandableStringEnum<T>> Collection<T> values(Class<T> clazz) {
        // Make a copy of all values
        Collection<? extends ExpandableStringEnum<?>> values = new ArrayList<>(valuesByName.values());

        Collection<T> list = new HashSet<T>();
        for (ExpandableStringEnum<?> value : values) {
            if (value.getClass().isAssignableFrom(clazz)) {
                list.add((T) value);
            }
        }

        return list;
    }
438110
@SuppressWarnings("unchecked")
    static <T> T getEnumValue(Class<T> cls, String name) {
        HashMap<String, Object> enumMap = enumMaps.get(cls);
        if (enumMap == null) {
            T[] consts = cls.getEnumConstants();
            enumMap = new HashMap<String, Object>(consts.length);
            for (T e : consts) {
                enumMap.put(((Enum<?>) e).toString(), e);
            }
            enumMaps.put(cls, enumMap);
        }
        T v = (T) enumMap.get(name);
        if (v == null) {
            v = (T) enumMap.get("Other");
        }
        return v;
    }
101566
public <T extends Enum<T>> Optional<T> getEnum(String key, Class<T> clazz) {
    return this.get(key).map(value -> asEnumValue(key, value, clazz));
  }
840502
@SuppressWarnings("unchecked")
    public <T> List<T> getAnnotations(final Class<? extends Annotation> clazz) {
        return (List<T>) foundAnnotations.get(clazz);
    }
1110459
public static <T extends Enum<?>> String getEnumValuesAsString(Class<T> enumClass) {
		//ScoringStrategy[] vals = ScoringStrategy.values();
		T[] vals = enumClass.getEnumConstants();

		StringBuilder str = new StringBuilder();
		if(vals.length == 1) {
			str.append(vals[0].name());
		} else if(vals.length > 1 ) {
			for(int i=0;i<vals.length-1;i++) {
				str.append(vals[i].name());
				str.append(", ");
			}
			str.append("or ");
			str.append(vals[vals.length-1].name());
		}

		return str.toString();
	}
1161009
public static List<Method> getBeanSetters(Class<?> clazz) {
    List<Method> methods = CollectUtils.newArrayList();
    for (Method m : clazz.getMethods()) {
      if (m.getName().startsWith("set") && m.getName().length() > 3) {
        if (Modifier.isPublic(m.getModifiers()) && !Modifier.isStatic(m.getModifiers())
            && m.getParameterTypes().length == 1) {
          methods.add(m);
        }
      }
    }
    return methods;
  }
570383
public <T extends Enum<T>> Optional<ImmutableSet<T>> getEnumSet(String key, Class<T> clazz) {
    return this.get(key)
        .map(
            value ->
                Streams.stream(Splitter.on(',').omitEmptyStrings().split(value))
                    .map(v -> asEnumValue(key, v, clazz))
                    .collect(toImmutableSet()));
  }
1162873
public static List<ConversionMethod> getConversionMethods(Class<?> clazz){
		List<ConversionMethod> conversions = new ArrayList<ConversionMethod>();
		
			for(Method method:getAnnotatedMethods(clazz))
				try{   conversions.add(Converter.toConversionMethod(method));
				}catch (ConversionParameterException e) {
					Error.wrongParameterNumber(method.getName(),clazz.getSimpleName());
				}catch (DynamicConversionParameterException e) {
					Error.parametersUsageNotAllowed(method.getName(), clazz.getSimpleName());
				}catch (DynamicConversionMethodException e) {
					Error.incorrectMethodDefinition(method.getName(), clazz.getSimpleName());
				}catch (DynamicConversionBodyException e) {
					Error.incorrectBodyDefinition(method.getName(), clazz.getSimpleName());
				}
		return conversions;
	}
114699
public static List<String> getFieldNames(Class<? extends Enum<?>> clazz) {
		final List<String> names = new ArrayList<>();
		final Field[] fields = ReflectUtil.getFields(clazz);
		String name;
		for (Field field : fields) {
			name = field.getName();
			if (field.getType().isEnum() || name.contains("$VALUES") || "ordinal".equals(name)) {
				continue;
			}
			if(false == names.contains(name)) {
				names.add(name);
			}
		}
		return names;
	}
1369334
public static Map<String, Type> getReflectiveMappingTypes(Class<? extends MailChimpObject> clazz) {
		Map<String, Type> types = reflectiveMappingsTypes.get(clazz);

		if (types == null) {
			types = new LinkedHashMap<String, Type>();

			for(Map.Entry<String, java.lang.reflect.Field> entry: getReflectiveMapping(clazz).entrySet()) {
				types.put(entry.getKey(), entry.getValue().getGenericType());
			}

			reflectiveMappingsTypes.put(clazz, Collections.unmodifiableMap(types));
		}

		return types;
	}
189754
public <T extends Enum<T>> List<T> getEnumList(final String param, final Class<T> clazz) {
    return this.getList(param, new StringToEnum<>(clazz), new AlwaysValid<T>(), "enumeration");
  }
675408
public static Map<String, List<Method>> getDeclaredMethodsRecursively(Class clazz) {
        final Map<String, List<Method>> current = Arrays
            .stream(clazz.getDeclaredMethods())
            .filter(m -> !m.getName().startsWith("lambda"))
            .collect(Collectors.groupingBy(Method::getName));
        for (Class interfaceClazz : clazz.getInterfaces()) {
            getDeclaredMethodsRecursively(interfaceClazz).forEach(current::putIfAbsent);
        }
        if (clazz.getSuperclass() != null) {
            getDeclaredMethodsRecursively(clazz.getSuperclass()).forEach(current::putIfAbsent);
        }
        return current;
    }
463377
private static List<Field> getAllFields(Class<?> clazz){
		if(!clazz.equals(Object.class)){
			List<Field> fields = new ArrayList<Field>(Arrays.asList(clazz.getDeclaredFields()));
			List<Field> fields2 = getAllFields(clazz.getSuperclass());
			if(fields2!=null){
				fields.addAll(fields2);
			}
			return fields;
		}else{
			return null;
		}
	}
837063
public static Map<String, Field> findFields(final Class<?> clazz) {
        Map<String, Field> foundFields = new HashMap<>();
        Class<?> searchType = clazz;
        while (!Object.class.equals(searchType) && (searchType != null)) {
            Field[] fields = searchType.getDeclaredFields();
            for (Field field : fields) {
                field.setAccessible(true);
                if(foundFields.get(field.getName()) == null) {
                    foundFields.put(field.getName(), field);
                }
            }
            searchType = searchType.getSuperclass();
        }
        return foundFields;
    }
928253
public <T extends ServiceConfiguration<?>> List<T> getExistingServiceConfigurations(Class<T> clazz) {
    ArrayList<T> results = new ArrayList<>();
    for (ServiceConfiguration<?> serviceConfiguration : serviceConfigurations) {
      if (clazz.equals(serviceConfiguration.getClass())) {
        results.add(clazz.cast(serviceConfiguration));
      }
    }
    return results;
  }
306402
public static String getTypeName(Class<?> clazz) {
		Type typeAnnotation = clazz.getAnnotation(Type.class);
		return typeAnnotation != null ? typeAnnotation.value() : null;
	}
296371
public <T extends Object> List<T> findAll(Class<T> clazz) {
        Preconditions.checkNotNull(clazz, "Tryed to get all morphia objects of a given object, but given object is null");

        return this.datastore.find(clazz).asList();
    }