public static Optional < LeavingEvent > createLeavingEvent ( Identification source , boolean strict , List < String > descriptors ) { try { if ( strict ) { descriptors . add ( STRICT_DESCRIPTOR ) ; } else { descriptors . add ( GENERAL_DESCRIPTOR ) ; } descriptors . add ( ID ) ; descriptors . add ( CommonEvents . Descriptors . NOT_INTERRUPT ) ; LeavingEvent stopRequest = new LeavingEvent ( source , descriptors ) ; return Optional . of ( stopRequest ) ; } catch ( IllegalArgumentException e ) { return Optional . empty ( ) ; } }
creates a new LeavingEvent