public enum DefinedState extends java.lang.Enum<DefinedState> implements SubscriptionState
Represents the nine possible defined subscription states.
Each state can transition to a new state depending on an in- or outbound presence subscription change.
Presence.Type
,
RFC 6121, A.1. Defined StatesSubscriptionState.Subscription
Enum Constant and Description |
---|
BOTH
User and contact are subscribed to each other (two-way);
this is reflected in the user's roster by subscription='both'.
|
FROM
Contact is subscribed to user (one-way);
this is reflected in the user's roster by subscription='from'.
|
FROM_PENDING_OUT
Contact is subscribed to user, and user has sent contact a subscription request but contact has not replied yet;
this is reflected in the user's roster by subscription='from' and ask='subscribe'.
|
NONE
Contact and user are not subscribed to each other, and neither has requested a subscription from the other;
this is reflected in the user's roster by subscription='none'.
|
NONE_PENDING_IN
Contact and user are not subscribed to each other, and contact has sent user a subscription request but user has not replied yet.
|
NONE_PENDING_OUT
Contact and user are not subscribed to each other, and user has sent contact a subscription request but contact has not replied yet;
this is reflected in the user's roster by subscription='none' and ask='subscribe'.
|
NONE_PENDING_OUT_IN
Contact and user are not subscribed to each other, contact has sent user a subscription request but user has not replied yet,
and user has sent contact a subscription request but contact has not replied yet;
this is reflected in the user's roster by subscription='none' and ask='subscribe'.
|
TO
User is subscribed to contact (one-way);
this is reflected in the user's roster by subscription='to'.
|
TO_PENDING_IN
User is subscribed to contact, and contact has sent user a subscription request but user has not replied yet;
this is reflected in the user's roster by subscription='to'.
|
Modifier and Type | Method and Description |
---|---|
SubscriptionState.Subscription |
getSubscription()
Gets the primary subscription state.
|
boolean |
isPendingIn()
If the presence subscription is pending in from a user’s perspective.
|
boolean |
isPendingOut()
If the presence subscription is pending out from a user’s perspective.
|
DefinedState |
onInboundSubscriptionChange(Presence.Type type)
Transforms an existing subscription state into a new state, depending on an inbound presence subscription change.
|
DefinedState |
onOutboundSubscriptionChange(Presence.Type type)
Transforms an existing subscription state into a new state, depending on an outbound presence subscription change.
|
static DefinedState |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static DefinedState |
valueOf(SubscriptionState subscriptionState)
Returns a defined subscription state from an existing subscription state, e.g. a
RosterItem . |
static DefinedState[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
equals
public static final DefinedState NONE
public static final DefinedState NONE_PENDING_OUT
public static final DefinedState NONE_PENDING_IN
public static final DefinedState NONE_PENDING_OUT_IN
public static final DefinedState TO
public static final DefinedState TO_PENDING_IN
public static final DefinedState FROM
public static final DefinedState FROM_PENDING_OUT
public static final DefinedState BOTH
public static DefinedState[] values()
for (DefinedState c : DefinedState.values()) System.out.println(c);
public static DefinedState valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static DefinedState valueOf(SubscriptionState subscriptionState)
Returns a defined subscription state from an existing subscription state, e.g. a RosterItem
.
subscriptionState
- The existing subscription state.null
.public final SubscriptionState.Subscription getSubscription()
SubscriptionState
Gets the primary subscription state. It may be one of SubscriptionState.Subscription.NONE
, SubscriptionState.Subscription.TO
, SubscriptionState.Subscription.FROM
or SubscriptionState.Subscription.BOTH
.
getSubscription
in interface SubscriptionState
public final boolean isPendingOut()
SubscriptionState
If the presence subscription is pending out from a user’s perspective. The user has sent contact a subscription request but contact has not replied yet.
isPendingOut
in interface SubscriptionState
public final boolean isPendingIn()
SubscriptionState
If the presence subscription is pending in from a user’s perspective. The contact has sent user a subscription request but user has not replied yet.
isPendingIn
in interface SubscriptionState
public final DefinedState onOutboundSubscriptionChange(Presence.Type type)
Transforms an existing subscription state into a new state, depending on an outbound presence subscription change.
type
- The presence subscription type.public final DefinedState onInboundSubscriptionChange(Presence.Type type)
Transforms an existing subscription state into a new state, depending on an inbound presence subscription change.
type
- The presence subscription type.Copyright © 2014–2019 XMPP.rocks. All rights reserved.