src/main/java/org/intellimate/izou/sdk/frameworks/presence/events/PresenceEvent.java
public static Optional<PresenceEvent> createPresenceEvent(Identification source, boolean strict, boolean known,
                                                                    boolean firstEncounter, List<String> descriptors) {
        try {
            if (strict) {
                descriptors.add(STRICT_DESCRIPTOR);
            } else {
                descriptors.add(GENERAL_DESCRIPTOR);
            }
            if (known) {
                descriptors.add(KNOWN_DESCRIPTOR);
            } else {
                descriptors.add(UNKNOWN_DESCRIPTOR);
            }
            if (firstEncounter)
                descriptors.add(FIRST_ENCOUNTER_DESCRIPTOR);
            descriptors.add(ID);
            PresenceEvent stopRequest = new PresenceEvent(source, descriptors);
            return Optional.of(stopRequest);
        } catch (IllegalArgumentException e) {
            return Optional.empty();
        }
    }
public static Optional<PresenceEvent> createPresenceEvent(Identification source, boolean strict, boolean known,
                                                                    boolean firstEncounter, List<String> descriptors) {
        try {
            if (strict) {
                descriptors.add(STRICT_DESCRIPTOR);
            } else {
                descriptors.add(GENERAL_DESCRIPTOR);
            }
            if (known) {
                descriptors.add(KNOWN_DESCRIPTOR);
            } else {
                descriptors.add(UNKNOWN_DESCRIPTOR);
            }
            if (firstEncounter)
                descriptors.add(FIRST_ENCOUNTER_DESCRIPTOR);
            descriptors.add(ID);
            PresenceEvent stopRequest = new PresenceEvent(source, descriptors);
            return Optional.of(stopRequest);
        } catch (IllegalArgumentException e) {
            return Optional.empty();
        }
    }
public static Optional < PresenceEvent > createPresenceEvent ( Identification source , boolean strict , boolean known , boolean firstEncounter , List < String > descriptors ) { try { if ( strict ) { descriptors . add ( STRICT_DESCRIPTOR ) ; } else { descriptors . add ( GENERAL_DESCRIPTOR ) ; } if ( known ) { descriptors . add ( KNOWN_DESCRIPTOR ) ; } else { descriptors . add ( UNKNOWN_DESCRIPTOR ) ; } if ( firstEncounter ) descriptors . add ( FIRST_ENCOUNTER_DESCRIPTOR ) ; descriptors . add ( ID ) ; PresenceEvent stopRequest = new PresenceEvent ( source , descriptors ) ; return Optional . of ( stopRequest ) ; } catch ( IllegalArgumentException e ) { return Optional . empty ( ) ; } }
creates a new PresenceEvent
@param source the caller
@param strict whether the addon can guarantee that the user is around
@param known true if the addon knows if the person encountered is the (main) user
@param firstEncounter if the user was first encountered in the specified mode
@param descriptors the descriptors
@return the optional PresenceEvent
creates a new PresenceEvent