Class Resourcepart

java.lang.Object
org.jxmpp.jid.parts.Part
org.jxmpp.jid.parts.Resourcepart
All Implemented Interfaces:
Serializable, CharSequence

public class Resourcepart extends Part
A resourcepart of an XMPP address (JID).

You can create instances of this class from Strings using from(String).

See Also:
  • Field Details

    • EMPTY

      public static final Resourcepart EMPTY
      The empty resource part.

      This empty resource part is the part that is represented by the empty String. This is useful in cases where you have a collection of Resourceparts that does not allow null values, but you want to deal with the "no resource" case.

  • Method Details

    • fromOrNull

      public static Resourcepart fromOrNull(CharSequence cs)
      Get a Resourcepart from a given CharSequence or null if the input is not a valid resourcepart.
      Parameters:
      cs - the input CharSequence
      Returns:
      a Resourcepart or null
    • fromOrThrowUnchecked

      public static Resourcepart fromOrThrowUnchecked(CharSequence cs)
      Like from(String) but does throw an unchecked IllegalArgumentException instead of a XmppStringprepException.
      Parameters:
      cs - the character sequence which should be transformed to a Resourcepart
      Returns:
      the Resourcepart if no exception occurs
      Throws:
      IllegalArgumentException - if the given input is not a valid Resourcepart
      Since:
      0.6.2
      See Also:
    • from

      public static Resourcepart from(String resource) throws org.jxmpp.stringprep.XmppStringprepException
      Get the Resourcepart representing the input String.
      Parameters:
      resource - the input String.
      Returns:
      the resource part.
      Throws:
      org.jxmpp.stringprep.XmppStringprepException - if an error occurs.
    • from

      public static Resourcepart from(String resource, org.jxmpp.JxmppContext context) throws org.jxmpp.stringprep.XmppStringprepException
      Get the Resourcepart representing the input String.
      Parameters:
      resource - the input String.
      context - the JXMPP context.
      Returns:
      the resource part.
      Throws:
      org.jxmpp.stringprep.XmppStringprepException - if an error occurs.