@Override
    public String compact(final StringBuilder builder, final Ticket ticket) throws Exception {
        if (ticket instanceof final ServiceAwareTicket sat && Objects.nonNull(sat.getService())) {
            builder.append(String.format("%s%s", DELIMITER, StringUtils.defaultString(sat.getService().getShortenedId())));
        } else {
            builder.append("%s*".formatted(DELIMITER));
        }
        if (ticket instanceof final RenewableServiceTicket rst) {
            builder.append(String.format("%s%s", DELIMITER, BooleanUtils.toString(rst.isFromNewLogin(), "1", "0")));
        } else {
            builder.append("%s0".formatted(DELIMITER));
        }

        if (ticket instanceof final AuthenticationAwareTicket aat) {
            builder.append(compactAuthenticationAttempt(aat).toString());
        } else {
            builder.append("%s*%s0".formatted(DELIMITER, DELIMITER));
        }
        return builder.toString();
    }
This is {@link ServiceTicketCompactor}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-stateless-ticket-registry/src/main/java/org/apereo/cas/ticket/registry/compact/ServiceTicketCompactor.java