Java Code Examples for org.azeckoski.reflectutils.ClassFields

The following examples show how to use org.azeckoski.reflectutils.ClassFields. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: sofa-acts   Source File:    License: Apache License 2.0 6 votes vote down vote up
public static Map<String, Field> findTargetClsFields(Class<?> cls) {
    if (isWrapClass(cls)) {
        return null;
    ReflectUtils refUtil = ReflectUtils.getInstance();
    ClassFields<?> clsFiled = refUtil.analyzeClass(cls);
    List<Field> getPro = clsFiled.getClassData().getFields();
    Map<String, Field> reClsProp = new HashMap<String, Field>();
    for (Field proValue : getPro) {
        if (Modifier.isFinal(proValue.getModifiers())
            || Modifier.isStatic(proValue.getModifiers())) {
        String propName = proValue.getName();
        reClsProp.put(propName, proValue);

    return reClsProp;
Example 2
Source Project: reflectutils   Source File:    License: Apache License 2.0 6 votes vote down vote up
public Enum convertInterface(Object value, Class<? extends Enum> implementationType) {
    Enum convert = null;
    String name = value.toString(); // can only deal with strings
    // now we try to find the enum field in this enum class
    ClassFields<Enum> cf = (ClassFields<Enum>) getFieldUtils().analyzeClass(implementationType);
    List<Enum> enumConstants = cf.getClassData().getEnumConstants();
    for (Enum e : enumConstants) {
        if ( {
            // found the matching enum
            convert = e;
    if (convert == null) {
        throw new UnsupportedOperationException("Failure attempting to create enum for name ("+name+") in ("+implementationType+")");
    return convert;