Source:
<code>public static CircuitBreakerEventDTO createCircuitBreakerEventDTO(CircuitBreakerEvent event) { switch (event.getEventType()) { case ERROR: CircuitBreakerOnErrorEvent onErrorEvent = (CircuitBreakerOnErrorEvent) event; return newCircuitBreakerEventDTOBuilder(onErrorEvent) .setThrowable(onErrorEvent.getThrowable()) .setDuration(onErrorEvent.getElapsedDuration()) .build(); case SUCCESS: CircuitBreakerOnSuccessEvent onSuccessEvent = (CircuitBreakerOnSuccessEvent) event; return newCircuitBreakerEventDTOBuilder(onSuccessEvent) .setDuration(onSuccessEvent.getElapsedDuration()) .build(); case STATE_TRANSITION: CircuitBreakerOnStateTransitionEvent onStateTransitionEvent = (CircuitBreakerOnStateTransitionEvent) event; return newCircuitBreakerEventDTOBuilder(onStateTransitionEvent) .setStateTransition(onStateTransitionEvent.getStateTransition()) .build(); case RESET: CircuitBreakerOnResetEvent onResetEvent = (CircuitBreakerOnResetEvent) event; return newCircuitBreakerEventDTOBuilder(onResetEvent) .build(); case IGNORED_ERROR: CircuitBreakerOnIgnoredErrorEvent onIgnoredErrorEvent = (CircuitBreakerOnIgnoredErrorEvent) event; return newCircuitBreakerEventDTOBuilder(onIgnoredErrorEvent) .setThrowable(onIgnoredErrorEvent.getThrowable()) .setDuration(onIgnoredErrorEvent.getElapsedDuration()) .build(); case NOT_PERMITTED: CircuitBreakerOnCallNotPermittedEvent onCallNotPermittedEvent = (CircuitBreakerOnCallNotPermittedEvent) event; return newCircuitBreakerEventDTOBuilder(onCallNotPermittedEvent) .build(); <START> case FAILURE_RATE_EXCEEDED: <END> CircuitBreakerOnFailureRateExceededEvent onFailureRateExceededEvent = (CircuitBreakerOnFailureRateExceededEvent) event; return newCircuitBreakerEventDTOBuilder(onFailureRateExceededEvent) .build(); default: throw new IllegalArgumentException("Invalid event"); } }</code><technical_language>I need add SLOW_CALL_RATE_EXCEEDED type too. do @RobWin</technical_language>

Target:
public static CircuitBreakerEventDTO createCircuitBreakerEventDTO(CircuitBreakerEvent event) { switch (event.getEventType()) { case ERROR: CircuitBreakerOnErrorEvent onErrorEvent = (CircuitBreakerOnErrorEvent) event; return newCircuitBreakerEventDTOBuilder(onErrorEvent) .setThrowable(onErrorEvent.getThrowable()) .setDuration(onErrorEvent.getElapsedDuration()) .build(); case SUCCESS: CircuitBreakerOnSuccessEvent onSuccessEvent = (CircuitBreakerOnSuccessEvent) event; return newCircuitBreakerEventDTOBuilder(onSuccessEvent) .setDuration(onSuccessEvent.getElapsedDuration()) .build(); case STATE_TRANSITION: CircuitBreakerOnStateTransitionEvent onStateTransitionEvent = (CircuitBreakerOnStateTransitionEvent) event; return newCircuitBreakerEventDTOBuilder(onStateTransitionEvent) .setStateTransition(onStateTransitionEvent.getStateTransition()) .build(); case RESET: CircuitBreakerOnResetEvent onResetEvent = (CircuitBreakerOnResetEvent) event; return newCircuitBreakerEventDTOBuilder(onResetEvent) .build(); case IGNORED_ERROR: CircuitBreakerOnIgnoredErrorEvent onIgnoredErrorEvent = (CircuitBreakerOnIgnoredErrorEvent) event; return newCircuitBreakerEventDTOBuilder(onIgnoredErrorEvent) .setThrowable(onIgnoredErrorEvent.getThrowable()) .setDuration(onIgnoredErrorEvent.getElapsedDuration()) .build(); case NOT_PERMITTED: CircuitBreakerOnCallNotPermittedEvent onCallNotPermittedEvent = (CircuitBreakerOnCallNotPermittedEvent) event; return newCircuitBreakerEventDTOBuilder(onCallNotPermittedEvent) .build(); case FAILURE_RATE_EXCEEDED: CircuitBreakerOnFailureRateExceededEvent onFailureRateExceededEvent = (CircuitBreakerOnFailureRateExceededEvent) event; return newCircuitBreakerEventDTOBuilder(onFailureRateExceededEvent) .build(); case SLOW_CALL_RATE_EXCEEDED: CircuitBreakerOnSlowCallRateExceededEvent onSlowCallRateExceededEvent = (CircuitBreakerOnSlowCallRateExceededEvent) event; return newCircuitBreakerEventDTOBuilder(onSlowCallRateExceededEvent) .build(); default: throw new IllegalArgumentException("Invalid event"); } }