當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.isNullOrEmpty方法代碼示例

本文整理匯總了Java中org.jivesoftware.smack.util.StringUtils.isNullOrEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.isNullOrEmpty方法的具體用法?Java StringUtils.isNullOrEmpty怎麽用?Java StringUtils.isNullOrEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jivesoftware.smack.util.StringUtils的用法示例。


在下文中一共展示了StringUtils.isNullOrEmpty方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: StreamError

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public StreamError(Condition condition, String conditionText, Map<String, String> descriptiveTexts, List<ExtensionElement> extensions) {
    super(descriptiveTexts, extensions);
    // Some implementations may send the condition as non-empty element containing the empty string, that is
    // <condition xmlns='foo'></condition>, in this case the parser may calls this constructor with the empty string
    // as conditionText, therefore reset it to null if it's the empty string
    if (StringUtils.isNullOrEmpty(conditionText)) {
        conditionText = null;
    }
    if (conditionText != null) {
        switch (condition) {
        case see_other_host:
            break;
        default:
            throw new IllegalArgumentException("The given condition '" + condition
                            + "' can not contain a conditionText");
        }
    }
    this.condition = condition;
    this.conditionText = conditionText;
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:21,代碼來源:StreamError.java

示例2: OnceForThisStanza

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
private OnceForThisStanza(XMPPTCPConnection connection, Stanza packet) {
    this.connection = connection;
    this.id = packet.getStanzaId();
    if (StringUtils.isNullOrEmpty(id)) {
        throw new IllegalArgumentException("Stanza ID must be set");
    }
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:8,代碼來源:OnceForThisStanza.java

示例3: accept

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
@Override
public boolean accept(Stanza packet) {
    String otherId = packet.getStanzaId();
    if (StringUtils.isNullOrEmpty(otherId)) {
        return false;
    }
    if (id.equals(otherId)) {
        connection.removeRequestAckPredicate(this);
        return true;
    }
    return false;
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:13,代碼來源:OnceForThisStanza.java

示例4: validate

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
private static void validate(String elementName, String namespace) {
    if (StringUtils.isNullOrEmpty(elementName)) {
        throw new IllegalArgumentException("elementName must not be null or empty");
    }
    if (StringUtils.isNullOrEmpty(namespace)) {
        throw new IllegalArgumentException("namespace must not be null or empty");
    }
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:9,代碼來源:ProviderManager.java

示例5: XMPPError

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
 * Creates a new error with the specified type, condition and message.
 * This constructor is used when the condition is not recognized automatically by XMPPError
 * i.e. there is not a defined instance of ErrorCondition or it does not apply the default 
 * specification.
 * 
 * @param type the error type.
 * @param condition the error condition.
 * @param descriptiveTexts 
 * @param extensions list of stanza(/packet) extensions
 */
public XMPPError(Condition condition, String conditionText, String errorGenerator, Type type, Map<String, String> descriptiveTexts,
        List<ExtensionElement> extensions) {
    super(descriptiveTexts, NAMESPACE, extensions);
    this.condition = condition;
    // Some implementations may send the condition as non-empty element containing the empty string, that is
    // <condition xmlns='foo'></condition>, in this case the parser may calls this constructor with the empty string
    // as conditionText, therefore reset it to null if it's the empty string
    if (StringUtils.isNullOrEmpty(conditionText)) {
        conditionText = null;
    }
    if (conditionText != null) {
        switch (condition) {
        case gone:
        case redirect:
            break;
        default:
            throw new IllegalArgumentException(
                            "Condition text can only be set with condtion types 'gone' and 'redirect', not "
                                            + condition);
        }
    }
    this.conditionText = conditionText;
    this.errorGenerator = errorGenerator;
    if (type == null) {
        Type determinedType = CONDITION_TO_TYPE.get(condition);
        if (determinedType == null) {
            LOGGER.warning("Could not determine type for condition: " + condition);
            determinedType = Type.CANCEL;
        }
        this.type = determinedType;
    } else {
        this.type = type;
    }
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:46,代碼來源:XMPPError.java

示例6: getActiveList

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
 * Answer the active privacy list. Returns <code>null</code> if there is no active list.
 * 
 * @return the privacy list of the active list.
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */ 
public PrivacyList getActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException  {
    Privacy privacyAnswer = this.getPrivacyWithListNames();
    String listName = privacyAnswer.getActiveName();
    if (StringUtils.isNullOrEmpty(listName)) {
        return null;
    }
    boolean isDefaultAndActive = listName != null && listName.equals(privacyAnswer.getDefaultName());
    return new PrivacyList(true, isDefaultAndActive, listName, getPrivacyListItems(listName));
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:18,代碼來源:PrivacyListManager.java

示例7: getDefaultList

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
 * Answer the default privacy list. Returns <code>null</code> if there is no default list.
 * 
 * @return the privacy list of the default list.
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */ 
public PrivacyList getDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException {
    Privacy privacyAnswer = this.getPrivacyWithListNames();
    String listName = privacyAnswer.getDefaultName();
    if (StringUtils.isNullOrEmpty(listName)) {
        return null;
    }
    boolean isDefaultAndActive = listName.equals(privacyAnswer.getActiveName());
    return new PrivacyList(isDefaultAndActive, true, listName, getPrivacyListItems(listName));
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:18,代碼來源:PrivacyListManager.java

示例8: send

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
 * Sends the specified stanza(/packet) to the collection of specified recipients using the specified
 * connection. If the server has support for XEP-33 then only one stanza(/packet) is going to be sent to
 * the server with the multiple recipient instructions. However, if XEP-33 is not supported by
 * the server then the client is going to send the stanza(/packet) to each recipient.
 * 
 * @param connection the connection to use to send the packet.
 * @param packet the stanza(/packet) to send to the list of recipients.
 * @param to the collection of JIDs to include in the TO list or <tt>null</tt> if no TO list exists.
 * @param cc the collection of JIDs to include in the CC list or <tt>null</tt> if no CC list exists.
 * @param bcc the collection of JIDs to include in the BCC list or <tt>null</tt> if no BCC list
 *        exists.
 * @param replyTo address to which all replies are requested to be sent or <tt>null</tt>
 *        indicating that they can reply to any address.
 * @param replyRoom JID of a MUC room to which responses should be sent or <tt>null</tt>
 *        indicating that they can reply to any address.
 * @param noReply true means that receivers should not reply to the message.
 * @throws XMPPErrorException if server does not support XEP-33: Extended Stanza Addressing and
 *         some XEP-33 specific features were requested.
 * @throws NoResponseException if there was no response from the server.
 * @throws FeatureNotSupportedException if special XEP-33 features where requested, but the
 *         server does not support them.
 * @throws NotConnectedException 
 */
public static void send(XMPPConnection connection, Stanza packet, Collection<String> to, Collection<String> cc, Collection<String> bcc,
        String replyTo, String replyRoom, boolean noReply) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException {
    // Check if *only* 'to' is set and contains just *one* entry, in this case extended stanzas addressing is not
    // required at all and we can send it just as normal stanza without needing to add the extension element
    if (to != null && to.size() == 1 && (cc == null || cc.isEmpty()) && (bcc == null || bcc.isEmpty()) && !noReply
                    && StringUtils.isNullOrEmpty(replyTo) && StringUtils.isNullOrEmpty(replyRoom)) {
        String toJid = to.iterator().next();
        packet.setTo(toJid);
        connection.sendStanza(packet);
        return;
    }
    String serviceAddress = getMultipleRecipienServiceAddress(connection);
    if (serviceAddress != null) {
        // Send packet to target users using multiple recipient service provided by the server
        sendThroughService(connection, packet, to, cc, bcc, replyTo, replyRoom, noReply,
                serviceAddress);
    }
    else {
        // Server does not support XEP-33 so try to send the packet to each recipient
        if (noReply || (replyTo != null && replyTo.trim().length() > 0) ||
                (replyRoom != null && replyRoom.trim().length() > 0)) {
            // Some specified XEP-33 features were requested so throw an exception alerting
            // the user that this features are not available
            throw new FeatureNotSupportedException("Extended Stanza Addressing");
        }
        // Send the packet to each individual recipient
        sendToIndividualRecipients(connection, packet, to, cc, bcc);
    }
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:54,代碼來源:MultipleRecipientManager.java

示例9: getAuthenticationText

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
@Override
protected byte[] getAuthenticationText() throws SmackException {
    if (StringUtils.isNullOrEmpty(authenticationId)) {
        return null;
    }

    return toBytes(XmppStringUtils.completeJidFrom(authenticationId, serviceName));
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:9,代碼來源:SASLExternalMechanism.java

示例10: claimButtonClicked

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public void claimButtonClicked(View view) {
	final String sn = mSnTextView.getText().toString();
	if (StringUtils.isNullOrEmpty(sn)) {
		showInGui("SN not set");
		return;
	}

	final String man = mManTextView.getText().toString();
	if (StringUtils.isNullOrEmpty(man)) {
		showInGui("MAN not set");
		return;
	}

	final String model = mModelTextView.getText().toString();
	if (StringUtils.isNullOrEmpty(model)) {
		showInGui("MODEL not set");
		return;
	}

	final String v = mVTextView.getText().toString();
	if (StringUtils.isNullOrEmpty(v)) {
		showInGui("V not set");
		return;
	}

	final String key = mKeyTextView.getText().toString();
	if (StringUtils.isNullOrEmpty(key)) {
		showInGui("KEY not set");
		return;
	}

	final Thing thing = Thing.builder()
			.setSerialNumber(sn)
			.setManufacturer(man)
			.setModel(model)
			.setVersion(v)
			.setKey(key)
			.build();

	Async.go(() -> claimButtonClicked(thing));
}
 
開發者ID:Flowdalic,項目名稱:android-xmpp-iot-demo,代碼行數:42,代碼來源:ClaimThingActivity.java


注:本文中的org.jivesoftware.smack.util.StringUtils.isNullOrEmpty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。