Class GoogleQuery.SearchResult

    • Field Detail

      • serialVersionUID

        🡇    
        public static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.

        Functional Interfaces are usually not thought of as Data Objects that need to be saved, stored and retrieved; however, having the ability to store intermediate results along with the lambda-functions that helped get those results can make debugging easier.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final long serialVersionUID = 1;
        
      • url

        🡅  🡇    
        public final java.lang.String url
        This is the link of 'this' search result.
        Code:
        Exact Field Declaration Expression:
         public final String url;
        
      • title

        🡅  🡇    
        public final java.lang.String title
        This is the "Anchor Text" that Google provided for this link. To be specific, it is the text between the <A HREF=url> and the </A>.
        Code:
        Exact Field Declaration Expression:
         public final String title;
        
      • subResults

        🡅  🡇    
        public final GoogleQuery.SearchResult[] subResults
        Usually, this array will be null. Note, null will be used in place of a zero length array. There are some sites for which a search-result would have multiple, or even numerous matches for a given search-String. When a search using Google provides more than one result, the list of 'Additional Matches' are scraped and put into this array.
        Code:
        Exact Field Declaration Expression:
         public final SearchResult[] subResults;
        
    • Method Detail

      • toString

        🡅    
        public java.lang.String toString()
        Converts this search result to a simple String
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String version of this Search Result.
        Code:
        Exact Method Body:
         if (subResults == null) return title + '\n' + url + '\n';
        
         StringBuilder sb = new StringBuilder();
        
         for (SearchResult sr : subResults)
             sb.append('\t' + sr.title + "\n\t" + sr.url + '\n');
        
         return title + '\n' + url + '\n' + sb.toString();