Class AbstractSelectable

  • All Implemented Interfaces:
    Selectable
    Direct Known Subclasses:
    HtmlNode, PlainText

    public abstract class AbstractSelectable
    extends java.lang.Object
    implements Selectable
    Since:
    0.5.2
    Author:
    code4crafer@gmail.com
    • Constructor Detail

      • AbstractSelectable

        public AbstractSelectable()
    • Method Detail

      • getSourceTexts

        protected abstract java.util.List<java.lang.String> getSourceTexts()
      • css

        public Selectable css​(java.lang.String selector)
        Description copied from interface: Selectable
        select list with css selector
        Specified by:
        css in interface Selectable
        Parameters:
        selector - css selector expression
        Returns:
        new Selectable after extract
      • css

        public Selectable css​(java.lang.String selector,
                              java.lang.String attrName)
        Description copied from interface: Selectable
        select list with css selector
        Specified by:
        css in interface Selectable
        Parameters:
        selector - css selector expression
        attrName - attribute name of css selector
        Returns:
        new Selectable after extract
      • select

        protected Selectable select​(Selector selector,
                                    java.util.List<java.lang.String> strings)
      • selectList

        protected Selectable selectList​(Selector selector,
                                        java.util.List<java.lang.String> strings)
      • all

        public java.util.List<java.lang.String> all()
        Description copied from interface: Selectable
        multi string result
        Specified by:
        all in interface Selectable
        Returns:
        multi string result
      • jsonPath

        public Selectable jsonPath​(java.lang.String jsonPath)
        Description copied from interface: Selectable
        extract by JSON Path expression
        Specified by:
        jsonPath in interface Selectable
        Parameters:
        jsonPath - jsonPath
        Returns:
        result
      • get

        public java.lang.String get()
        Description copied from interface: Selectable
        single string result
        Specified by:
        get in interface Selectable
        Returns:
        single string result
      • select

        public Selectable select​(Selector selector)
        Description copied from interface: Selectable
        extract by custom selector
        Specified by:
        select in interface Selectable
        Parameters:
        selector - selector
        Returns:
        result
      • regex

        public Selectable regex​(java.lang.String regex)
        Description copied from interface: Selectable
        select list with regex, default group is group 1
        Specified by:
        regex in interface Selectable
        Parameters:
        regex - regex
        Returns:
        new Selectable after extract
      • regex

        public Selectable regex​(java.lang.String regex,
                                int group)
        Description copied from interface: Selectable
        select list with regex
        Specified by:
        regex in interface Selectable
        Parameters:
        regex - regex
        group - group
        Returns:
        new Selectable after extract
      • replace

        public Selectable replace​(java.lang.String regex,
                                  java.lang.String replacement)
        Description copied from interface: Selectable
        replace with regex
        Specified by:
        replace in interface Selectable
        Parameters:
        regex - regex
        replacement - replacement
        Returns:
        new Selectable after extract
      • getFirstSourceText

        public java.lang.String getFirstSourceText()
      • toString

        public java.lang.String toString()
        Description copied from interface: Selectable
        single string result
        Specified by:
        toString in interface Selectable
        Overrides:
        toString in class java.lang.Object
        Returns:
        single string result
      • match

        public boolean match()
        Description copied from interface: Selectable
        if result exist for select
        Specified by:
        match in interface Selectable
        Returns:
        true if result exist