Class JivePropertiesExtension

  • All Implemented Interfaces:
    org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.ExtensionElement, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.XmlElement, org.jivesoftware.smack.packet.XmlLangElement

    public class JivePropertiesExtension
    extends java.lang.Object
    implements org.jivesoftware.smack.packet.ExtensionElement
    Properties provide an easy mechanism for clients to share data. Each property has a String name, and a value that is a Java primitive (int, long, float, double, boolean) or any Serializable object (a Java object is Serializable when it implements the Serializable interface).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ELEMENT  
      static java.lang.String NAMESPACE
      Namespace used to store stanza properties.
      static javax.xml.namespace.QName QNAME  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void deleteProperty​(java.lang.String name)
      Deletes a property.
      static JivePropertiesExtension from​(org.jivesoftware.smack.packet.Message message)
      Return a Jive properties extensions of the given message.
      java.lang.String getElementName()  
      java.lang.String getNamespace()  
      java.util.Map<java.lang.String,​java.lang.Object> getProperties()
      Returns an unmodifiable map of all properties.
      java.lang.Object getProperty​(java.lang.String name)
      Returns the stanza property with the specified name or null if the property doesn't exist.
      java.util.Collection<java.lang.String> getPropertyNames()
      Returns an unmodifiable collection of all the property names that are set.
      void setProperty​(java.lang.String name, java.lang.Object value)
      Sets a property with an Object as the value.
      java.lang.CharSequence toXML​(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.jivesoftware.smack.packet.Element

        toXML, toXML
      • Methods inherited from interface org.jivesoftware.smack.packet.XmlElement

        getLanguage, getQName
    • Field Detail

      • NAMESPACE

        public static final java.lang.String NAMESPACE
        Namespace used to store stanza properties.
        See Also:
        Constant Field Values
      • QNAME

        public static final javax.xml.namespace.QName QNAME
    • Constructor Detail

      • JivePropertiesExtension

        public JivePropertiesExtension()
      • JivePropertiesExtension

        public JivePropertiesExtension​(java.util.Map<java.lang.String,​java.lang.Object> properties)
    • Method Detail

      • getProperty

        public java.lang.Object getProperty​(java.lang.String name)
        Returns the stanza property with the specified name or null if the property doesn't exist. Property values that were originally primitives will be returned as their object equivalent. For example, an int property will be returned as an Integer, a double as a Double, etc.
        Parameters:
        name - the name of the property.
        Returns:
        the property, or null if the property doesn't exist.
      • setProperty

        public void setProperty​(java.lang.String name,
                                java.lang.Object value)
        Sets a property with an Object as the value. The value must be Serializable or an IllegalArgumentException will be thrown.
        Parameters:
        name - the name of the property.
        value - the value of the property.
      • deleteProperty

        public void deleteProperty​(java.lang.String name)
        Deletes a property.
        Parameters:
        name - the name of the property to delete.
      • getPropertyNames

        public java.util.Collection<java.lang.String> getPropertyNames()
        Returns an unmodifiable collection of all the property names that are set.
        Returns:
        all property names.
      • getProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getProperties()
        Returns an unmodifiable map of all properties.
        Returns:
        all properties.
      • getElementName

        public java.lang.String getElementName()
        Specified by:
        getElementName in interface org.jivesoftware.smack.packet.NamedElement
      • getNamespace

        public java.lang.String getNamespace()
        Specified by:
        getNamespace in interface org.jivesoftware.smack.packet.XmlElement
      • toXML

        public java.lang.CharSequence toXML​(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
        Specified by:
        toXML in interface org.jivesoftware.smack.packet.Element
      • from

        public static JivePropertiesExtension from​(org.jivesoftware.smack.packet.Message message)
        Return a Jive properties extensions of the given message.
        Parameters:
        message - the message to return the extension from.
        Returns:
        a Jive properties extension or null.
        Since:
        4.2