本文整理了Java中org.jivesoftware.smack.util.Objects.requireNonNull()
方法的一些代码示例,展示了Objects.requireNonNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objects.requireNonNull()
方法的具体详情如下:
包路径:org.jivesoftware.smack.util.Objects
类名称:Objects
方法名:requireNonNull
[英]Require a collection to be neither null, nor empty.
[中]要求集合既不能为null,也不能为空。
代码示例来源:origin: igniterealtime/Smack
protected AbstractHttpOverXmpp(String element, Builder<?, ?> builder) {
super(element, NAMESPACE);
this.headers = builder.headers;
this.data = builder.data;
this.version = Objects.requireNonNull(builder.version, "version must not be null");
}
代码示例来源:origin: igniterealtime/Smack
protected EncryptedOpenPgpContentElement(Set<Jid> to, String rpad, Date timestamp, List<ExtensionElement> payload) {
super(Objects.requireNonNullNorEmpty(
to, "Encrypted OpenPGP content elements must have at least one 'to' attribute."),
timestamp, payload);
this.rpad = Objects.requireNonNull(rpad);
}
代码示例来源:origin: igniterealtime/Smack
private HttpOverXmppResp(Builder builder) {
super(ELEMENT, builder);
this.statusCode = Objects.requireNonNull(builder.statusCode, "statusCode must not be null");
this.statusMessage = builder.statusMessage;
}
代码示例来源:origin: igniterealtime/Smack
/**
* Creates a NOT filter using the specified filter.
*
* @param filter the filter.
*/
public NotFilter(StanzaFilter filter) {
this.filter = Objects.requireNonNull(filter, "Parameter must not be null.");
}
代码示例来源:origin: igniterealtime/Smack
/**
* Sets the type of the IQ packet.
* <p>
* Since the type of an IQ must present, an IllegalArgmentException will be thrown when type is
* <code>null</code>.
* </p>
*
* @param type the type of the IQ packet.
*/
public void setType(Type type) {
this.type = Objects.requireNonNull(type, "type must not be null");
}
代码示例来源:origin: igniterealtime/Smack
/**
* Set the DNS resolver that should be used to perform DNS lookups.
*
* @param resolver
*/
public static void setDNSResolver(DNSResolver resolver) {
dnsResolver = Objects.requireNonNull(resolver);
}
代码示例来源:origin: igniterealtime/Smack
/**
* Set the DANE provider that should be used when DANE is enabled.
*
* @param daneProvider
*/
public static void setDaneProvider(SmackDaneProvider daneProvider) {
DNSUtil.daneProvider = Objects.requireNonNull(daneProvider);
}
代码示例来源:origin: igniterealtime/Smack
/**
* Create a new OmemoMessageElement from a header and a payload.
*
* @param header header of the message
* @param payload payload
*/
public OmemoElement(OmemoHeaderElement header, byte[] payload) {
this.header = Objects.requireNonNull(header);
this.payload = payload;
}
代码示例来源:origin: igniterealtime/Smack
/**
* Create a new IdleElement.
* @param since date of last user interaction
*/
public IdleElement(Date since) {
this.since = Objects.requireNonNull(since);
}
代码示例来源:origin: igniterealtime/Smack
protected AbstractOpenPgpStore(OpenPgpKeyStore keyStore,
OpenPgpMetadataStore metadataStore,
OpenPgpTrustStore trustStore) {
this.keyStore = Objects.requireNonNull(keyStore);
this.metadataStore = Objects.requireNonNull(metadataStore);
this.trustStore = Objects.requireNonNull(trustStore);
}
代码示例来源:origin: igniterealtime/Smack
/**
* Set how Smack behaves when an unknown IQ request has been received.
*
* @param unknownIqRequestReplyMode reply mode.
*/
public void setUnknownIqRequestReplyMode(UnknownIqRequestReplyMode unknownIqRequestReplyMode) {
this.unknownIqRequestReplyMode = Objects.requireNonNull(unknownIqRequestReplyMode, "Mode must not be null");
}
代码示例来源:origin: igniterealtime/Smack
public void signal(R result) {
synchronized (this) {
this.result = Objects.requireNonNull(result);
notifyAll();
}
}
代码示例来源:origin: igniterealtime/Smack
/**
* Creates an filter using the specified filters.
*
* @param filters the filters to add.
*/
protected AbstractListFilter(StanzaFilter... filters) {
Objects.requireNonNull(filters, "Parameter must not be null.");
for (StanzaFilter filter : filters) {
Objects.requireNonNull(filter, "Parameter must not be null.");
}
this.filters = new ArrayList<StanzaFilter>(Arrays.asList(filters));
}
代码示例来源:origin: igniterealtime/Smack
public Checksum(JingleContent.Creator creator, String name, JingleFileTransferChild file) {
this.creator = creator;
this.name = name;
this.file = Objects.requireNonNull(file, "file MUST NOT be null.");
Objects.requireNonNull(file.getHash(), "file MUST contain at least one hash element.");
}
代码示例来源:origin: igniterealtime/Smack
/**
* Constructor.
*
* @param bytes bytes of the XML representation of the decrypted {@link OpenPgpContentElement}.
* @param state {@link State} of the {@link OpenPgpContentElement}.
* @param metadata metadata about the encryption.
*/
public OpenPgpMessage(byte[] bytes, State state, OpenPgpMetadata metadata) {
this(new String(Objects.requireNonNull(bytes), Charset.forName("UTF-8")), state, metadata);
}
代码示例来源:origin: igniterealtime/Smack
public Builder addAttribute(String name, String value) {
StringUtils.requireNotNullNorEmpty(name, "Attribute name must be set");
Objects.requireNonNull(value, "Attribute value must be not null");
if (attributes == null) {
attributes = new LinkedHashMap<>();
}
attributes.put(name, value);
return this;
}
代码示例来源:origin: igniterealtime/Smack
/**
* Default constructor.
*
* @param jid The JID of the stream host.
* @param address The internet address of the stream host.
* @param port port of the stream host.
*/
public StreamHost(final Jid jid, final String address, int port) {
this.jid = Objects.requireNonNull(jid, "StreamHost JID must not be null");
this.address = StringUtils.requireNotNullNorEmpty(address, "StreamHost address must not be null");
this.port = port;
}
代码示例来源:origin: igniterealtime/Smack
public AuthMechanism(String mechanism, String authenticationText) {
this.mechanism = Objects.requireNonNull(mechanism, "SASL mechanism shouldn't be null.");
this.authenticationText = StringUtils.requireNotNullNorEmpty(authenticationText,
"SASL authenticationText must not be null nor empty (RFC6120 6.4.2)");
}
代码示例来源:origin: igniterealtime/Smack
public HostedRoom(DiscoverItems.Item item) {
jid = Objects.requireNonNull(item.getEntityID().asEntityBareJidIfPossible(),
"The discovered item must be an entity bare JID");
name = item.getName();
}
代码示例来源:origin: igniterealtime/Smack
protected OpenPgpContentElement(Set<Jid> to, Date timestamp, List<ExtensionElement> payload) {
this.to = to;
this.timestamp = Objects.requireNonNull(timestamp);
this.payload = new MultiMap<>();
for (ExtensionElement e : payload) {
this.payload.put(XmppStringUtils.generateKey(e.getElementName(), e.getNamespace()), e);
}
}
内容来源于网络,如有侵权,请联系作者删除!