Class SubscribeOptions

  • All Implemented Interfaces:
    StandardizedDataForm

    public final class SubscribeOptions
    extends Object
    implements StandardizedDataForm
    Represents a standardized DataForm with form type http://jabber.org/protocol/pubsub#subscribe_options, which can be used to configure a node subscription.

    Usage

    To wrap an existing DataForm to retrieve standard data from it, use:
    
     SubscribeOptions subscribeOptions = new SubscribeOptions(dataForm);
     
    To build a form:
    
     SubscribeOptions subscribeOptions = SubscribeOptions.builder()
         .deliver(true)
         .digest(true)
         .digestFrequency(3)
         .includeBody(true)
         .temporary(true)
         .showValues(Arrays.asList(AbstractPresence.Show.AWAY, AbstractPresence.Show.CHAT, null))
         .subscriptionType(SubscribeOptions.SubscriptionType.NODES)
         .subscriptionDepth(-1)
         .build();
     
    See Also:
    16.4.2 pubsub#subscribe_options FORM_TYPE
    • Constructor Detail

      • SubscribeOptions

        public SubscribeOptions​(DataForm dataForm)
    • Method Detail

      • builder

        public static SubscribeOptions.Builder builder()
        Creates a builder to build subscribe options.
        Returns:
        The builder.
      • isDeliver

        public final Boolean isDeliver()
        Whether an entity wants to receive or disable notifications.
        Returns:
        True, if notifications are delivered.
      • isDigest

        public Boolean isDigest()
        Whether an entity wants to receive digests (aggregations) of notifications or all notifications individually.
        Returns:
        True, if digests are sent.
      • getDigestFrequency

        public final Integer getDigestFrequency()
        The minimum number of milliseconds between sending any two notification digests
        Returns:
        The digest frequency.
      • getExpire

        public final Instant getExpire()
        The DateTime at which a leased subscription will end or has ended.
        Returns:
        The expiration date.
      • isIncludeBody

        public final boolean isIncludeBody()
        Whether an entity wants to receive an XMPP message body in addition to the payload format.
        Returns:
        True, if the body is included.
      • getShowValues

        public final List<Presence.Show> getShowValues()
        Gets the show values.
        Returns:
        The show values.
      • getSubscriptionDepth

        public final Integer getSubscriptionDepth()
        Gets the subscription depth. A negative value of -1 represents "all".
        Returns:
        The subscription depth.
      • isTemporary

        public final boolean isTemporary()
        Whether the subscription is temporary, i.e. presence-based.
        Returns:
        True, if the subscription is temporary.
      • toBuilder

        public final SubscribeOptions.Builder toBuilder()
        Converts this (immutable) data form to a builder, so that a modified form can be created.
        Returns:
        The builder.