private Type getParametrizedTypeOfJobListener(Class<?> listenerClass) {
        Type[] interfaces = listenerClass.getGenericInterfaces();
        Type[] typeParameters = null;
        for (Type anInterface : interfaces) {
            // Checks if the class get parameters
            if (!(anInterface instanceof ParameterizedType)) {
                continue;
            }
            // Gets rawType to check if the interface is TaskListener
            Class interfaceClass = (Class) ((ParameterizedType) anInterface).getRawType();
            if (TaskListener.class.isAssignableFrom(interfaceClass)) {
                typeParameters = ((ParameterizedType) anInterface).getActualTypeArguments();
                break;
            }
        }
        if (typeParameters == null || typeParameters.length == 0) {
            throw SeedException.createNew(SchedulerErrorCode.MISSING_TYPE_PARAMETER)
                    .put("class", listenerClass);
        }

        return typeParameters[0];
    }
private Type getParametrizedTypeOfJobListener ( Class < ? > listenerClass ) { Type [ ] interfaces = listenerClass . getGenericInterfaces ( ) ; Type [ ] typeParameters = null ; for ( Type anInterface : interfaces ) { if ( ! ( anInterface instanceof ParameterizedType ) ) { continue ; } Class interfaceClass = ( Class ) ( ( ParameterizedType ) anInterface ) . getRawType ( ) ; if ( TaskListener . class . isAssignableFrom ( interfaceClass ) ) { typeParameters = ( ( ParameterizedType ) anInterface ) . getActualTypeArguments ( ) ; break ; } } if ( typeParameters == null || typeParameters . length == 0 ) { throw SeedException . createNew ( SchedulerErrorCode . MISSING_TYPE_PARAMETER ) . put ( "class" , listenerClass ) ; } return typeParameters [ 0 ] ; }
Returns the type parameter of the TaskListener interface.

@param listenerClass class to check
@return type which extends Task
@throws SeedException if no parameter type is present