public static Optional < EventListener > createEventListener ( String descriptor , String description , String descriptorID , Identifiable identifiable ) throws IllegalArgumentException { if ( ! descriptorID . matches ( "[\\w\\-_]+" ) ) throw new IllegalArgumentException ( "descriptorID: " + descriptorID + " contains illegal characters" ) ; return IdentificationManagerM . getInstance ( ) . getIdentification ( identifiable ) . flatMap ( id -> Event . createEvent ( CommonEvents . Type . NOTIFICATION_TYPE , id , Collections . singletonList ( descriptor ) ) ) . map ( event -> new EventListener ( event , descriptor , description , descriptorID ) ) ; }
Create the EventListener .