mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-21 10:07:58 +01:00
26 lines
573 B
Markdown
26 lines
573 B
Markdown
|
Developer Documentation: Stanzas and PacketExtensions
|
||
|
|
||
|
PacketExtension
|
||
|
===============
|
||
|
|
||
|
The static `from(Packet)` Method
|
||
|
--------------------------------
|
||
|
|
||
|
Every PacketExtension class must have a static `from()` method that retrieves that extension for a given Stanza (if any).
|
||
|
|
||
|
Sample Code
|
||
|
|
||
|
```java
|
||
|
public static RSMSet from(Packet) {
|
||
|
return packet.getExtension(ELEMENT, NAMESPACE);
|
||
|
}
|
||
|
```
|
||
|
|
||
|
Sometimes certain PacketExtension's are only found in one stanza type, in that case, specify the parameter type. For example `public static CarbonExtension getFrom(Message)`.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|