public static Optional < Class > resolveGenericTypeArgument ( Field field ) { Type genericType = field != null ? field . getGenericType ( ) : null ; if ( genericType instanceof ParameterizedType ) { Type [ ] typeArguments = ( ( ParameterizedType ) genericType ) . getActualTypeArguments ( ) ; if ( typeArguments . length > 0 ) { Type typeArg = typeArguments [ 0 ] ; return resolveParameterizedTypeArgument ( typeArg ) ; } } return Optional . empty ( ) ; }
Resolves a single generic type argument for the given field .