org.jsoup.helper.Validate.notNull()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中org.jsoup.helper.Validate.notNull()方法的一些代码示例,展示了Validate.notNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Validate.notNull()方法的具体详情如下:
包路径:org.jsoup.helper.Validate
类名称:Validate
方法名:notNull

Validate.notNull介绍

[英]Validates that the object is not null
[中]

代码示例

代码示例来源:origin: org.jsoup/jsoup

public T method(Method method) {
  Validate.notNull(method, "Method must not be null");
  this.method = method;
  return (T) this;
}

代码示例来源:origin: org.jsoup/jsoup

public KeyVal inputStream(InputStream inputStream) {
  Validate.notNull(value, "Data input stream must not be null");
  this.stream = inputStream;
  return this;
}

代码示例来源:origin: org.jsoup/jsoup

/**
 Create a new TokenQueue.
 @param data string of data to back queue.
 */
public TokenQueue(String data) {
  Validate.notNull(data);
  queue = data;
}

代码示例来源:origin: org.jsoup/jsoup

/**
 * Set the document's output settings.
 * @param outputSettings new output settings.
 * @return this document, for chaining.
 */
public Document outputSettings(OutputSettings outputSettings) {
  Validate.notNull(outputSettings);
  this.outputSettings = outputSettings;
  return this;
}

代码示例来源:origin: org.jsoup/jsoup

/**
 Create a new cleaner, that sanitizes documents using the supplied whitelist.
 @param whitelist white-list to clean with
 */
public Cleaner(Whitelist whitelist) {
  Validate.notNull(whitelist);
  this.whitelist = whitelist;
}

代码示例来源:origin: org.jsoup/jsoup

public T url(URL url) {
  Validate.notNull(url, "URL must not be null");
  this.url = url;
  return (T) this;
}

代码示例来源:origin: org.jsoup/jsoup

private int indexOfKeyIgnoreCase(String key) {
  Validate.notNull(key);
  for (int i = 0; i < size; i++) {
    if (key.equalsIgnoreCase(keys[i]))
      return i;
  }
  return NotFound;
}

代码示例来源:origin: org.jsoup/jsoup

int indexOfKey(String key) {
  Validate.notNull(key);
  for (int i = 0; i < size; i++) {
    if (key.equals(keys[i]))
      return i;
  }
  return NotFound;
}

代码示例来源:origin: org.jsoup/jsoup

/**
 * Find elements matching selector.
 *
 * @param evaluator CSS selector
 * @param root root element to descend into
 * @return matching elements, empty if none
 */
public static Elements select(Evaluator evaluator, Element root) {
  Validate.notNull(evaluator);
  Validate.notNull(root);
  return Collector.collect(evaluator, root);
}

代码示例来源:origin: org.jsoup/jsoup

/**
 * Insert the specified node into the DOM after this node (i.e. as a following sibling).
 * @param node to add after this node
 * @return this node, for chaining
 * @see #before(Node)
 */
public Node after(Node node) {
  Validate.notNull(node);
  Validate.notNull(parentNode);
  parentNode.addChildren(siblingIndex + 1, node);
  return this;
}

代码示例来源:origin: org.jsoup/jsoup

/**
 * Replace this node in the DOM with the supplied node.
 * @param in the node that will will replace the existing node.
 */
public void replaceWith(Node in) {
  Validate.notNull(in);
  Validate.notNull(parentNode);
  parentNode.replaceChild(this, in);
}

代码示例来源:origin: org.jsoup/jsoup

public Connection userAgent(String userAgent) {
  Validate.notNull(userAgent, "User agent must not be null");
  req.header(USER_AGENT, userAgent);
  return this;
}

代码示例来源:origin: org.jsoup/jsoup

/**
 * Remove (delete) this node from the DOM tree. If this node has children, they are also removed.
 */
public void remove() {
  Validate.notNull(parentNode);
  parentNode.removeChild(this);
}

代码示例来源:origin: org.jsoup/jsoup

public Connection referrer(String referrer) {
  Validate.notNull(referrer, "Referrer must not be null");
  req.header("Referer", referrer);
  return this;
}

代码示例来源:origin: org.jsoup/jsoup

/**
 * Add this element to the supplied parent element, as its next child.
 *
 * @param parent element to which this element will be appended
 * @return this element, so that you can continue modifying the element
 */
public Element appendTo(Element parent) {
  Validate.notNull(parent);
  parent.appendChild(this);
  return this;
}

代码示例来源:origin: org.jsoup/jsoup

public String header(String name) {
  Validate.notNull(name, "Header name must not be null");
  List<String> vals = getHeadersCaseInsensitive(name);
  if (vals.size() > 0) {
    // https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
    return StringUtil.join(vals, ", ");
  }
  return null;
}

代码示例来源:origin: org.jsoup/jsoup

/**
 Add a class name to this element's {@code class} attribute.
 @param className class name to add
 @return this element
 */
public Element addClass(String className) {
  Validate.notNull(className);
  Set<String> classes = classNames();
  classes.add(className);
  classNames(classes);
  return this;
}

代码示例来源:origin: org.jsoup/jsoup

/**
 * Create and append a new TextNode to this element.
 * 
 * @param text the unencoded text to add
 * @return this element
 */
public Element appendText(String text) {
  Validate.notNull(text);
  TextNode node = new TextNode(text);
  appendChild(node);
  return this;
}

代码示例来源:origin: org.jsoup/jsoup

/**
 * Create and prepend a new TextNode to this element.
 * 
 * @param text the unencoded text to add
 * @return this element
 */
public Element prependText(String text) {
  Validate.notNull(text);
  TextNode node = new TextNode(text);
  prependChild(node);
  return this;
}

代码示例来源:origin: org.jsoup/jsoup

@Override
public String attr(String key) {
  Validate.notNull(key);
  if (!hasAttributes()) {
    return key.equals(nodeName()) ? (String) value : EmptyString;
  }
  return super.attr(key);
}

相关文章