code: @SuppressWarnings("unchecked")
     public static <T> T convert(Object object, @NonNull Class<T> desiredType) {
        if (object == null) {
           if (desiredType != null && desiredType.isPrimitive()) {
              return Defaults.defaultValue(desiredType);
           }
           return null;
        }
  
  
        if (object instanceof Val) {
           return convert(Cast.as(object, Val.class).get(), desiredType);
        }
  
        //Handle Enums
        if (Enum.class.isAssignableFrom(desiredType)) {
           Class<? extends Enum> enumClass = Cast.as(desiredType);
           return Cast.as(new EnumConverter(enumClass).apply(object));
        }
  
        //Handle Object arrays
        if (desiredType.isArray() && !desiredType.getComponentType().isPrimitive()) {
           Class<?> componentType = desiredType.getComponentType();
           return Cast.as(new ArrayConverter<>(componentType).apply(object));
        }
  
        if (converters.containsKey(desiredType)) {
           Object output = converters.get(desiredType).apply(object);
           if (output == null && desiredType.isPrimitive()) {
              return Defaults.defaultValue(desiredType);
           }
           return Cast.as(output);
        }
  
        if (Map.class.isAssignableFrom(desiredType)) {
           return Cast.as(convert(object, desiredType, Object.class, Object.class));
        }
  
  
        T result = new NewObjectConverter<>(desiredType).apply(object);
        if (result != null) {
           return result;
        }
  
        if (desiredType.isAssignableFrom(object.getClass())) {
           return Cast.as(object);
        }
  
        log.fine("Unable to convert object of type {0} to desired type of {1}", object.getClass(), desiredType);
        return null;
     }
docs: Convert t.
  
  @param <T>         the type parameter
  @param object      the object
  @param desiredType the desired type
  @return the t