code: static <T> Pair<Boolean, T> constructViaMethod(Class<T> type, String fromValue) {
  
  		// Try to usse fromString before valueOf (enums have valueOf already defined) - in case we override fromString()
  		List<Method> methods = getMethods(type, "fromString", "valueOf");
  
  		if (methods != null && methods.size() > 0) {
  
  			for (Method method : methods) {
  
  				try {
  					Object value = method.invoke(null, fromValue);
  					return new Pair(true, value);
  				}
  				catch (IllegalAccessException | InvocationTargetException e) {
  					// failed with this one ... try the others ...
  					log.warn("Failed invoking static method: " + method.getName());
  				}
  			}
  		}
  
  		return new Pair<>(false, null);
  	}
docs: Constructs type via static method fromString(String value) or valueOf(String value)
  
  @param type      to be constructed
  @param fromValue value to take
  @param <T>       class type
  @return Object of type or null if failed to construct