public NodeInfo(String nodeId, String sourceId, String cacheType) { this.nodeId = StringUtils.requireNotNullOrEmpty(nodeId, "Node ID must not be null or empty"); this.sourceId = sourceId; this.cacheType = cacheType; }
/** * Creates a new thread filter using the specified thread value. * * @param thread the thread value to filter for. */ public ThreadFilter(String thread) { StringUtils.requireNotNullOrEmpty(thread, "Thread must not be null or empty."); this.thread = thread; }
/** * Sets the unique ID of the packet. To indicate that a stanza has no id * pass <code>null</code> as the packet's id value. * * @param id the unique ID for the packet. */ public void setStanzaId(String id) { if (id != null) { requireNotNullOrEmpty(id, "id must either be null or not the empty String"); } this.id = id; }
private XmlNsAttribute(String value) { this.value = StringUtils.requireNotNullOrEmpty(value, "Value must not be null"); this.xmlFragment = " xmlns='" + value + '\''; }
/** * Creates a new stanza ID filter using the specified stanza ID. * * @param stanzaID the stanza ID to filter for. */ public StanzaIdFilter(String stanzaID) { this.stanzaId = StringUtils.requireNotNullOrEmpty(stanzaID, "Stanza ID must not be null or empty."); }
public ExplicitMessageEncryptionElement(String encryptionNamespace, String name) { this.encryptionNamespace = StringUtils.requireNotNullOrEmpty(encryptionNamespace, "encryptionNamespace must not be null"); this.name = name; }
/** * Creates a new stanza extension filter. Packets will pass the filter if * they have a stanza extension that matches the specified element name * and namespace. * * @param elementName the XML element name of the stanza extension. * @param namespace the XML namespace of the stanza extension. */ public PacketExtensionFilter(String elementName, String namespace) { StringUtils.requireNotNullOrEmpty(namespace, "namespace must not be null or empty"); this.elementName = elementName; this.namespace = namespace; }
/** * Creates a new stanza extension filter. Stanzas will pass the filter if * they have a stanza extension that matches the specified element name * and namespace. * * @param elementName the XML element name of the stanza extension. * @param namespace the XML namespace of the stanza extension. */ public StanzaExtensionFilter(String elementName, String namespace) { StringUtils.requireNotNullOrEmpty(namespace, "namespace must not be null or empty"); this.elementName = elementName; this.namespace = namespace; }
protected AbstractTextElement(String text, String lang) { this.text = StringUtils.requireNotNullOrEmpty(text, "Text must not be null or empty"); this.lang = lang; }
private StandardExtensionElement(String name, String namespace, Map<String, String> attributes, String text, MultiMap<String, StandardExtensionElement> elements) { this.name = StringUtils.requireNotNullOrEmpty(name, "Name must not be null or empty"); this.namespace = StringUtils.requireNotNullOrEmpty(namespace, "Namespace must not be null or empty"); if (attributes == null) { this.attributes = Collections.emptyMap(); } else { this.attributes = attributes; } this.text = text; this.elements = elements; }
org.jivesoftware.smack.util.StringUtils.requireNotNullOrEmpty(id, "id");
/** * Creates a new stanza ID filter using the specified stanza ID. * * @param packetID the stanza ID to filter for. * @deprecated use {@link StanzaIdFilter#StanzaIdFilter(Stanza)} instead. */ @Deprecated public PacketIDFilter(String packetID) { StringUtils.requireNotNullOrEmpty(packetID, "Packet ID must not be null or empty."); this.packetID = packetID; }
public Tag(String name, Type type, String value) { // TODO According to XEP-0347 § 5.2 names are case insensitive. Uppercase them all? this.name = StringUtils.requireNotNullOrEmpty(name, "name must not be null or empty"); this.type = Objects.requireNonNull(type); this.value = StringUtils.requireNotNullOrEmpty(value, "value must not be null or empty"); if (this.name.length() > 32) { throw new IllegalArgumentException("Meta Tag names must not be longer then 32 characters (XEP-0347 § 5.2"); } if (this.type == Type.str && this.value.length() > 128) { throw new IllegalArgumentException("Meta Tag string values must not be longer then 128 characters (XEP-0347 § 5.2"); } }
public AuthMechanism(String mechanism, String authenticationText) { this.mechanism = Objects.requireNonNull(mechanism, "SASL mechanism shouldn't be null."); this.authenticationText = StringUtils.requireNotNullOrEmpty(authenticationText, "SASL authenticationText must not be null or empty (RFC6120 6.4.2)"); }
public Builder addAttribute(String name, String value) { StringUtils.requireNotNullOrEmpty(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; }
/** * Add the given mechanism to the enabled ones. See {@link #addEnabledSaslMechanism(Collection)} for a discussion about enabled SASL mechanisms. * * @param saslMechanism the name of the mechanism to enable. * @return a reference to this builder. */ public B addEnabledSaslMechanism(String saslMechanism) { return addEnabledSaslMechanism(Arrays.asList(StringUtils.requireNotNullOrEmpty(saslMechanism, "saslMechanism must not be null or empty"))); }
/** * SRV Record constructor. * * @param fqdn Fully qualified domain name * @param port The connection port * @param priority Priority of the target host * @param weight Relative weight for records with same priority * @param inetAddresses list of addresses. * @throws IllegalArgumentException fqdn is null or any other field is not in valid range (0-65535). */ public SRVRecord(DnsName fqdn, int port, int priority, int weight, List<InetAddress> inetAddresses) { super(fqdn, port, inetAddresses); StringUtils.requireNotNullOrEmpty(fqdn, "The FQDN must not be null"); if (weight < 0 || weight > 65535) throw new IllegalArgumentException( "DNS SRV records weight must be a 16-bit unsigned integer (i.e. between 0-65535. Weight was: " + weight); if (priority < 0 || priority > 65535) throw new IllegalArgumentException( "DNS SRV records priority must be a 16-bit unsigned integer (i.e. between 0-65535. Priority was: " + priority); this.priority = priority; this.weight = weight; }
/** * Return a list of all extensions with the given element name <em>and</em> namespace. * <p> * Changes to the returned set will update the stanza extensions, if the returned set is not the empty set. * </p> * * @param elementName the element name, must not be null. * @param namespace the namespace of the element(s), must not be null. * @return a set of all matching extensions. * @since 4.1 */ public List<ExtensionElement> getExtensions(String elementName, String namespace) { requireNotNullOrEmpty(elementName, "elementName must not be null or empty"); requireNotNullOrEmpty(namespace, "namespace must not be null or empty"); String key = XmppStringUtils.generateKey(elementName, namespace); return packetExtensions.getAll(key); }
/** * Login with the given username (authorization identity). You may omit the password if a callback handler is used. * If resource is null, then the server will generate one. * * @param username * @param password * @param resource * @throws XMPPException * @throws SmackException * @throws IOException * @throws InterruptedException * @see #login */ public synchronized void login(CharSequence username, String password, Resourcepart resource) throws XMPPException, SmackException, IOException, InterruptedException { if (!config.allowNullOrEmptyUsername) { StringUtils.requireNotNullOrEmpty(username, "Username must not be null or empty"); } throwNotConnectedExceptionIfAppropriate("Did you call connect() before login()?"); throwAlreadyLoggedInExceptionIfAppropriate(); usedUsername = username != null ? username.toString() : null; usedPassword = password; usedResource = resource; loginInternal(usedUsername, usedPassword, usedResource); }