code: private Object prepareValue(Class expectedClass, Object pValue) {
          if (pValue == null) {
              return null;
          }
          if (Enum.class.isAssignableFrom(expectedClass)) {
              return Enum.valueOf(expectedClass,pValue.toString());
          } else {
              return prepareForDirectUsage(expectedClass, pValue);
          }
      }
docs: use cases