@Override
    public synchronized int getCachedSize() throws CannotCalculateSizeException {
        if (cacheSize == -1) {
            int size = CacheSizes.sizeOfObject(); // overhead of object.
            size += CacheSizes.sizeOfAnything(roomJid);
            size += CacheSizes.sizeOfAnything(userJid);
            size += CacheSizes.sizeOfString(nick);
            size += CacheSizes.sizeOfAnything(extendedInformation);
            if (presence != null) {
                size += CacheSizes.sizeOfAnything(presence.getElement());
            }
            size += CacheSizes.sizeOfAnything(role);
            size += CacheSizes.sizeOfAnything(affiliation);
            size += CacheSizes.sizeOfBoolean(); // voiceOnly
            size += CacheSizes.sizeOfAnything(occupantJID);
            size += CacheSizes.sizeOfAnything(reportedFmucJID);

            cacheSize = size;
        }
        return cacheSize;
    }
Calculates and sets the extended presence information to add to the presence.
The information to add contains the user's jid, affiliation and role.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCOccupant.java