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 standardizedDataFormwith form typehttp://jabber.org/protocol/pubsub#subscribe_options, which can be used to configure a node subscription.Usage
To wrap an existingDataFormto 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 classSubscribeOptions.BuilderA builder for the subscribe options.static classSubscribeOptions.SubscriptionTypeThe 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.Builderbuilder()Creates a builder to build subscribe options.DataFormgetDataForm()Gets the underlying data form.IntegergetDigestFrequency()The minimum number of milliseconds between sending any two notification digestsInstantgetExpire()The DateTime at which a leased subscription will end or has ended.StringgetFormType()Gets the form type of the data form.List<Presence.Show>getShowValues()Gets the show values.IntegergetSubscriptionDepth()Gets the subscription depth.SubscribeOptions.SubscriptionTypegetSubscriptionType()Gets the subscription type.BooleanisDeliver()Whether an entity wants to receive or disable notifications.BooleanisDigest()Whether an entity wants to receive digests (aggregations) of notifications or all notifications individually.booleanisIncludeBody()Whether an entity wants to receive an XMPP message body in addition to the payload format.booleanisTemporary()Whether the subscription is temporary, i.e. presence-based.SubscribeOptions.BuildertoBuilder()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:StandardizedDataFormGets the form type of the data form.- Specified by:
getFormTypein interfaceStandardizedDataForm- Returns:
- The form type.
-
getDataForm
public final DataForm getDataForm()
Gets the underlying data form.- Specified by:
getDataFormin 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.
-
-