Package rocks.xmpp.extensions.shim.model
Class Header
- java.lang.Object
-
- rocks.xmpp.extensions.shim.model.Header
-
public final class Header extends Object
A header element which hold stanza header information or internet metadata.This class is immutable.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getName()
Gets the name of the header.String
getValue()
Gets the value of the header.static Header
of(String name, String value)
Creates a header.static Header
ofClassification(String value)
Creates a 'Classification' header.static Header
ofCreated(OffsetDateTime dateTime)
Creates a header which specifies the date and time when a stanza was created by the originating entity.static Header
ofDistribute(boolean distribute)
The Distribute header enables a sender to specify whether the stanza may be further distributed by the recipient to other entities on the network.static Header
ofStartDate(OffsetDateTime dateTime)
Creates a header with a start date.static Header
ofStopDate(OffsetDateTime dateTime)
Creates a header with a stop date.static Header
ofStore(boolean store)
The Store header enables a sender to specify whether the stanza may be stored or archived by the recipient.static Header
ofTimeToLive(Duration timeToLive)
Specifies that the information contained in a stanza is valid only for a limited period of time.static Header
ofUrgency(String urgency)
Specifies that the information contained in a stanza is more or less time-sensitive.String
toString()
-
-
-
Method Detail
-
of
public static Header of(String name, String value)
Creates a header.- Parameters:
name
- The name of the header. See 9.3 SHIM Headers Registry for registered headers.value
- The header value.- Returns:
- The header.
- See Also:
- 9.3 SHIM Headers Registry
-
ofClassification
public static Header ofClassification(String value)
Creates a 'Classification' header.The Classification header enables a sender or other entity to classify a stanza according to some classification scheme.
- Parameters:
value
- The value.- Returns:
- The 'Classification' header.
- See Also:
- 5.1 Classification
-
ofCreated
public static Header ofCreated(OffsetDateTime dateTime)
Creates a header which specifies the date and time when a stanza was created by the originating entity.- Parameters:
dateTime
- The date time.- Returns:
- The 'Created' header.
- See Also:
- 5.2 Created
-
ofDistribute
public static Header ofDistribute(boolean distribute)
The Distribute header enables a sender to specify whether the stanza may be further distributed by the recipient to other entities on the network. The allowable values for this header are "true" and "false". If the sender specifies a value of "false", the recipient MUST NOT further distribute the stanza or any information contained therein; if the sender specifies a value of "true", the recipient MAY further distribute the stanza or any information contained therein; if the value is anything other than "true" or "false" and the recipient does not understand the value, the recipient MUST assume the default value of "false".- Parameters:
distribute
- If the stanza may be further distributed by the recipient.- Returns:
- The header.
- See Also:
- 5.3 Distribute
-
ofStore
public static Header ofStore(boolean store)
The Store header enables a sender to specify whether the stanza may be stored or archived by the recipient.- Parameters:
store
- If the stanza may be stored by the recipient.- Returns:
- The header.
- See Also:
- 5.4 Store
-
ofTimeToLive
public static Header ofTimeToLive(Duration timeToLive)
Specifies that the information contained in a stanza is valid only for a limited period of time.- Parameters:
timeToLive
- The time to live.- Returns:
- The header.
- See Also:
- 5.5 TTL
-
ofUrgency
public static Header ofUrgency(String urgency)
Specifies that the information contained in a stanza is more or less time-sensitive.- Parameters:
urgency
- The urgency, must be "high", "medium" or "low".- Returns:
- The header.
- See Also:
- 5.6 Urgency
-
ofStartDate
public static Header ofStartDate(OffsetDateTime dateTime)
Creates a header with a start date.- Parameters:
dateTime
- The start date.- Returns:
- The header.
- See Also:
- XEP-0149: Time Periods
-
ofStopDate
public static Header ofStopDate(OffsetDateTime dateTime)
Creates a header with a stop date.- Parameters:
dateTime
- The stop date.- Returns:
- The header.
- See Also:
- XEP-0149: Time Periods
-
getName
public final String getName()
Gets the name of the header.- Returns:
- The header.
-
getValue
public final String getValue()
Gets the value of the header.- Returns:
- The header.
-
-