当前位置: 首页>>代码示例>>Java>>正文


Java Collector.collect方法代码示例

本文整理汇总了Java中org.jsoup.select.Collector.collect方法的典型用法代码示例。如果您正苦于以下问题:Java Collector.collect方法的具体用法?Java Collector.collect怎么用?Java Collector.collect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jsoup.select.Collector的用法示例。


在下文中一共展示了Collector.collect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: call

import org.jsoup.select.Collector; //导入方法依赖的package包/类
@Override
public Elements call(Element e, List<String> args) {
    try {
        return Collector.collect(cache.get(args.get(0)), e);
    } catch (ExecutionException e1) {
        log.warn("error when loader css query rule cache", e1);
    }
    return e.select(args.get(0));// 发生异常则服务降级
}
 
开发者ID:virjar,项目名称:sipsoup,代码行数:10,代码来源:CacheCSSFunction.java

示例2: getElementsByTag

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Finds elements, including and recursively under this element, with the specified tag name.
 * @param tagName The tag name to search for (case insensitively).
 * @return a matching unmodifiable list of elements. Will be empty if this element and none of its children match.
 */
public Elements getElementsByTag(String tagName) {
    Validate.notEmpty(tagName);
    tagName = tagName.toLowerCase().trim();

    return Collector.collect(new Evaluator.Tag(tagName), this);
}
 
开发者ID:cpusoft,项目名称:common,代码行数:12,代码来源:Element.java

示例3: getElementById

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find an element by ID, including or under this element.
 * <p>
 * Note that this finds the first matching ID, starting with this element. If you search down from a different
 * starting point, it is possible to find a different element by ID. For unique element by ID within a Document,
 * use {@link Document#getElementById(String)}
 * @param id The ID to search for.
 * @return The first matching element by ID, starting with this element, or null if none found.
 */
public Element getElementById(String id) {
    Validate.notEmpty(id);
    
    Elements elements = Collector.collect(new Evaluator.Id(id), this);
    if (elements.size() > 0)
        return elements.get(0);
    else
        return null;
}
 
开发者ID:cpusoft,项目名称:common,代码行数:19,代码来源:Element.java

示例4: getElementsByAttribute

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find elements that have a named attribute set. Case insensitive.
 *
 * @param key name of the attribute, e.g. {@code href}
 * @return elements that have this attribute, empty if none
 */
public Elements getElementsByAttribute(String key) {
    Validate.notEmpty(key);
    key = key.trim().toLowerCase();

    return Collector.collect(new Evaluator.Attribute(key), this);
}
 
开发者ID:cpusoft,项目名称:common,代码行数:13,代码来源:Element.java

示例5: getElementsByAttributeStarting

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find elements that have an attribute name starting with the supplied prefix. Use {@code data-} to find elements
 * that have HTML5 datasets.
 * @param keyPrefix name prefix of the attribute e.g. {@code data-}
 * @return elements that have attribute names that start with with the prefix, empty if none.
 */
public Elements getElementsByAttributeStarting(String keyPrefix) {
    Validate.notEmpty(keyPrefix);
    keyPrefix = keyPrefix.trim().toLowerCase();

    return Collector.collect(new Evaluator.AttributeStarting(keyPrefix), this);
}
 
开发者ID:cpusoft,项目名称:common,代码行数:13,代码来源:Element.java

示例6: evaluate

import org.jsoup.select.Collector; //导入方法依赖的package包/类
@Override
public XElements evaluate(Element element) {
    Elements elements;
    if (evaluator != null) {
        elements = Collector.collect(evaluator, element);
    } else {
        elements = new Elements();
        elements.add(element);
    }
    return new DefaultXElements(elements, elementOperator);
}
 
开发者ID:code4craft,项目名称:xsoup,代码行数:12,代码来源:DefaultXPathEvaluator.java

示例7: evaluate

import org.jsoup.select.Collector; //导入方法依赖的package包/类
@Override
public XElements evaluate(Element element) {
    Elements elements = Collector.collect(evaluator, element);
    return new DefaultXElements(elements, elementOperator);
}
 
开发者ID:zongtui,项目名称:zongtui-webcrawler,代码行数:6,代码来源:DefaultXPathEvaluator.java

示例8: getElementsByClass

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find elements that have this class, including or under this element. Case insensitive.
 * <p>
 * Elements can have multiple classes (e.g. {@code <div class="header round first">}. This method
 * checks each class, so you can find the above with {@code el.getElementsByClass("header");}.
 * 
 * @param className the name of the class to search for.
 * @return elements with the supplied class name, empty if none
 * @see #hasClass(String)
 * @see #classNames()
 */
public Elements getElementsByClass(String className) {
    Validate.notEmpty(className);

    return Collector.collect(new Evaluator.Class(className), this);
}
 
开发者ID:cpusoft,项目名称:common,代码行数:17,代码来源:Element.java

示例9: getElementsByAttributeValue

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find elements that have an attribute with the specific value. Case insensitive.
 * 
 * @param key name of the attribute
 * @param value value of the attribute
 * @return elements that have this attribute with this value, empty if none
 */
public Elements getElementsByAttributeValue(String key, String value) {
    return Collector.collect(new Evaluator.AttributeWithValue(key, value), this);
}
 
开发者ID:cpusoft,项目名称:common,代码行数:11,代码来源:Element.java

示例10: getElementsByAttributeValueNot

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find elements that either do not have this attribute, or have it with a different value. Case insensitive.
 * 
 * @param key name of the attribute
 * @param value value of the attribute
 * @return elements that do not have a matching attribute
 */
public Elements getElementsByAttributeValueNot(String key, String value) {
    return Collector.collect(new Evaluator.AttributeWithValueNot(key, value), this);
}
 
开发者ID:cpusoft,项目名称:common,代码行数:11,代码来源:Element.java

示例11: getElementsByAttributeValueStarting

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find elements that have attributes that start with the value prefix. Case insensitive.
 * 
 * @param key name of the attribute
 * @param valuePrefix start of attribute value
 * @return elements that have attributes that start with the value prefix
 */
public Elements getElementsByAttributeValueStarting(String key, String valuePrefix) {
    return Collector.collect(new Evaluator.AttributeWithValueStarting(key, valuePrefix), this);
}
 
开发者ID:cpusoft,项目名称:common,代码行数:11,代码来源:Element.java

示例12: getElementsByAttributeValueEnding

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find elements that have attributes that end with the value suffix. Case insensitive.
 * 
 * @param key name of the attribute
 * @param valueSuffix end of the attribute value
 * @return elements that have attributes that end with the value suffix
 */
public Elements getElementsByAttributeValueEnding(String key, String valueSuffix) {
    return Collector.collect(new Evaluator.AttributeWithValueEnding(key, valueSuffix), this);
}
 
开发者ID:cpusoft,项目名称:common,代码行数:11,代码来源:Element.java

示例13: getElementsByAttributeValueContaining

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find elements that have attributes whose value contains the match string. Case insensitive.
 * 
 * @param key name of the attribute
 * @param match substring of value to search for
 * @return elements that have attributes containing this text
 */
public Elements getElementsByAttributeValueContaining(String key, String match) {
    return Collector.collect(new Evaluator.AttributeWithValueContaining(key, match), this);
}
 
开发者ID:cpusoft,项目名称:common,代码行数:11,代码来源:Element.java

示例14: getElementsByAttributeValueMatching

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find elements that have attributes whose values match the supplied regular expression.
 * @param key name of the attribute
 * @param pattern compiled regular expression to match against attribute values
 * @return elements that have attributes matching this regular expression
 */
public Elements getElementsByAttributeValueMatching(String key, Pattern pattern) {
    return Collector.collect(new Evaluator.AttributeWithValueMatching(key, pattern), this);
    
}
 
开发者ID:cpusoft,项目名称:common,代码行数:11,代码来源:Element.java

示例15: getElementsByIndexLessThan

import org.jsoup.select.Collector; //导入方法依赖的package包/类
/**
 * Find elements whose sibling index is less than the supplied index.
 * @param index 0-based index
 * @return elements less than index
 */
public Elements getElementsByIndexLessThan(int index) {
    return Collector.collect(new Evaluator.IndexLessThan(index), this);
}
 
开发者ID:cpusoft,项目名称:common,代码行数:9,代码来源:Element.java


注:本文中的org.jsoup.select.Collector.collect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。