Class ContentElement.Builder
- java.lang.Object
-
- org.jivesoftware.smackx.stanza_content_encryption.element.ContentElement.Builder
-
- Enclosing class:
- ContentElement
public static final class ContentElement.Builder extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentElement.Builder
addFurtherAffixElement(AffixElement customAffixElement)
Add an additional, SCE profile specific affix element.ContentElement.Builder
addPayloadItem(ExtensionElement payloadItem)
Add a payload item as child element of the payload element.ContentElement.Builder
addTo(ToAffixElement to)
Add an affix element of type 'to' which addresses one recipient.ContentElement.Builder
addTo(Jid jid)
Add an affix element of type 'to' which addresses one recipient.ContentElement
build()
Construct a content element from this builder.ContentElement.Builder
setFrom(FromAffixElement from)
Set the senders jid as a 'from' affix element.ContentElement.Builder
setFrom(Jid jid)
Set the senders jid as a 'from' affix element.ContentElement.Builder
setRandomPadding()
Set some random length random content padding.ContentElement.Builder
setRandomPadding(java.lang.String padding)
Set the given string as padding.ContentElement.Builder
setRandomPadding(RandomPaddingAffixElement padding)
Set a padding affix element.ContentElement.Builder
setTimestamp(java.util.Date date)
Set the given date as a 'time' affix element.ContentElement.Builder
setTimestamp(TimestampAffixElement timestamp)
Set the timestamp of the message as a 'time' affix element.
-
-
-
Method Detail
-
addTo
public ContentElement.Builder addTo(Jid jid)
Add an affix element of type 'to' which addresses one recipient. The jid in the 'to' element SHOULD be a bare jid.- Parameters:
jid
- jid- Returns:
- builder
-
addTo
public ContentElement.Builder addTo(ToAffixElement to)
Add an affix element of type 'to' which addresses one recipient.- Parameters:
to
- affix element- Returns:
- builder
-
setFrom
public ContentElement.Builder setFrom(Jid jid)
Set the senders jid as a 'from' affix element.- Parameters:
jid
- jid of the sender- Returns:
- builder
-
setFrom
public ContentElement.Builder setFrom(FromAffixElement from)
Set the senders jid as a 'from' affix element.- Parameters:
from
- affix element- Returns:
- builder
-
setTimestamp
public ContentElement.Builder setTimestamp(java.util.Date date)
Set the given date as a 'time' affix element.- Parameters:
date
- timestamp as date- Returns:
- builder
-
setTimestamp
public ContentElement.Builder setTimestamp(TimestampAffixElement timestamp)
Set the timestamp of the message as a 'time' affix element.- Parameters:
timestamp
- timestamp affix element- Returns:
- builder
-
setRandomPadding
public ContentElement.Builder setRandomPadding()
Set some random length random content padding.- Returns:
- builder
-
setRandomPadding
public ContentElement.Builder setRandomPadding(java.lang.String padding)
Set the given string as padding. The padding should be of length between 1 and 200 characters.- Parameters:
padding
- padding string- Returns:
- builder
-
setRandomPadding
public ContentElement.Builder setRandomPadding(RandomPaddingAffixElement padding)
Set a padding affix element.- Parameters:
padding
- affix element- Returns:
- builder
-
addFurtherAffixElement
public ContentElement.Builder addFurtherAffixElement(AffixElement customAffixElement)
Add an additional, SCE profile specific affix element.- Parameters:
customAffixElement
- additional affix element- Returns:
- builder
-
addPayloadItem
public ContentElement.Builder addPayloadItem(ExtensionElement payloadItem)
Add a payload item as child element of the payload element. There are some items that are not allowed as payload. Adding those will throw an exception.- Parameters:
payloadItem
- extension element- Returns:
- builder
- Throws:
java.lang.IllegalArgumentException
- in case an extension element from the blacklist is added.- See Also:
- XEP-0420: Stanza Content Encryption - ยง9. Server-processed Elements
-
build
public ContentElement build()
Construct a content element from this builder.- Returns:
- content element
-
-