Java Code Examples for org.jxmpp.jid.Jid#asDomainFullJidIfPossible()

The following examples show how to use org.jxmpp.jid.Jid#asDomainFullJidIfPossible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractJid.java    From jxmpp with Apache License 2.0 6 votes vote down vote up
@Override
public final boolean isParentOf(Jid jid) {
	EntityFullJid fullJid = jid.asEntityFullJidIfPossible();
	if (fullJid != null) {
		return isParentOf(fullJid);
	}
	EntityBareJid bareJid = jid.asEntityBareJidIfPossible();
	if (bareJid != null) {
		return isParentOf(bareJid);
	}
	DomainFullJid domainFullJid = jid.asDomainFullJidIfPossible();
	if (domainFullJid != null) {
		return isParentOf(domainFullJid);
	}

	return isParentOf(jid.asDomainBareJid());
}
 
Example 2
Source File: AbstractPossibleJidTypeFilter.java    From Smack with Apache License 2.0 6 votes vote down vote up
@Override
public final boolean accept(Stanza stanza) {
    final Jid jid = getJidToInspect(stanza);

    if (jid == null) {
        return false;
    }

    switch (jidType) {
    case entityFull:
        return null != jid.asEntityFullJidIfPossible();
    case entityBare:
        return null != jid.asEntityBareJidIfPossible();
    case domainFull:
        return null != jid.asDomainFullJidIfPossible();
    case domainBare:
    case any:
        return true;
    default:
        throw new AssertionError();
    }
}
 
Example 3
Source File: JidUtil.java    From jxmpp with Apache License 2.0 5 votes vote down vote up
/**
 * Filter all domain full JIDs.
 *
 * @param in the input collection.
 * @param out the collection where the filtered JIDs are added to.
 */
public static void filterDomainFullJid(Collection<? extends Jid> in, Collection<? super DomainFullJid> out) {
	for (Jid jid : in) {
		DomainFullJid domainFullJid = jid.asDomainFullJidIfPossible();
		if (domainFullJid != null) {
			out.add(domainFullJid);
		}
	}
}