protected <T extends Ticket> T produceTicket(final ProxyGrantingTicket proxyGrantingTicket,
                                                 final Service service, final String ticketId,
                                                 final Class<T> clazz) {
        val expirationPolicyToUse = determineExpirationPolicyForService(service);
        val result = proxyGrantingTicket.grantProxyTicket(
            ticketId,
            service,
            expirationPolicyToUse,
            this.onlyTrackMostRecentSession);

        if (!clazz.isAssignableFrom(result.getClass())) {
            throw new ClassCastException("Result [" + result
                + " is of type " + result.getClass()
                + " when we were expecting " + clazz);
        }
        return (T) result;
    }
protected < T extends Ticket > T produceTicket ( final ProxyGrantingTicket proxyGrantingTicket , final Service service , final String ticketId , final Class < T > clazz ) { val expirationPolicyToUse = determineExpirationPolicyForService ( service ) ; val result = proxyGrantingTicket . grantProxyTicket ( ticketId , service , expirationPolicyToUse , this . onlyTrackMostRecentSession ) ; if ( ! clazz . isAssignableFrom ( result . getClass ( ) ) ) { throw new ClassCastException ( "Result [" + result + " is of type " + result . getClass ( ) + " when we were expecting " + clazz ) ; } return ( T ) result ; }
Produce ticket.

@param <T>                 the type parameter
@param proxyGrantingTicket the proxy granting ticket
@param service             the service
@param ticketId            the ticket id
@param clazz               the clazz
@return the ticket