resolve

public static TypeToken<?> resolve(TypeToken<?> type, TypeVariable<? extends Class<? extends Object>> param)

Resolves the generic parameter of the passed type into an actual value.

If the resolved parameter type is Optional<T>, resolves its parameter T and returns the result. In case the Optional does not have the generic parameter, returns the type of Optional itself.