1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-23 06:42:05 +01:00
Smack/documentation/developer/stanzas.md
Florian Schmaus 58e430af42 PacketExtension.from(Packet), deprecate getFrom()
add 'from(Packet)' to DataForm
2014-09-16 22:22:25 +02:00

25 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)`.