src/main/java/org/intellimate/izou/sdk/contentgenerator/EventListener.java
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));
    }
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));
    }
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.

@param descriptor the descriptor of the Event you want to listen to
@param description the description of the descriptor
@param descriptorID an ID for the descriptor (Should contain no special characters, spaces etc.). Only String
which match the regex (\w-_)+ are allowed.
@param identifiable the identifiable which wants to create the EventListener
@return if one of the parameter is null, or unable to to obtain ID
@throws java.lang.IllegalArgumentException if the descriptorID contains illegal characters
Create the EventListener .