Class SubscribeOptions
- java.lang.Object
-
- rocks.xmpp.extensions.pubsub.model.SubscribeOptions
-
- All Implemented Interfaces:
StandardizedDataForm
public final class SubscribeOptions extends Object implements StandardizedDataForm
Represents a standardizedDataForm
with form typehttp://jabber.org/protocol/pubsub#subscribe_options
, which can be used to configure a node subscription.Usage
To wrap an existingDataForm
to retrieve standard data from it, use:
To build a form:SubscribeOptions subscribeOptions = new SubscribeOptions(dataForm);
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();
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SubscribeOptions.Builder
A builder for the subscribe options.static class
SubscribeOptions.SubscriptionType
The subscription type.
-
Constructor Summary
Constructors Constructor Description SubscribeOptions(DataForm dataForm)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SubscribeOptions.Builder
builder()
Creates a builder to build subscribe options.DataForm
getDataForm()
Gets the underlying data form.Integer
getDigestFrequency()
The minimum number of milliseconds between sending any two notification digestsInstant
getExpire()
The DateTime at which a leased subscription will end or has ended.String
getFormType()
Gets the form type of the data form.List<Presence.Show>
getShowValues()
Gets the show values.Integer
getSubscriptionDepth()
Gets the subscription depth.SubscribeOptions.SubscriptionType
getSubscriptionType()
Gets the subscription type.Boolean
isDeliver()
Whether an entity wants to receive or disable notifications.Boolean
isDigest()
Whether an entity wants to receive digests (aggregations) of notifications or all notifications individually.boolean
isIncludeBody()
Whether an entity wants to receive an XMPP message body in addition to the payload format.boolean
isTemporary()
Whether the subscription is temporary, i.e. presence-based.SubscribeOptions.Builder
toBuilder()
Converts this (immutable) data form to a builder, so that a modified form can be created.
-
-
-
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.
-
getFormType
public final String getFormType()
Description copied from interface:StandardizedDataForm
Gets the form type of the data form.- Specified by:
getFormType
in interfaceStandardizedDataForm
- Returns:
- The form type.
-
getDataForm
public final DataForm getDataForm()
Gets the underlying data form.- Specified by:
getDataForm
in interfaceStandardizedDataForm
- Returns:
- The underlying data form.
-
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.
-
getSubscriptionType
public final SubscribeOptions.SubscriptionType getSubscriptionType()
Gets the subscription type.- Returns:
- The subscription type.
-
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.
-
-