Skip to content

Commit

Permalink
Add some JavaDoc to Fetchers
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Mar 7, 2022
1 parent b304feb commit 3c247ff
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* Searches web resources for bibliographic information based on a {@link BibEntry}.
* Useful to complete an existing entry with fetched information.
* Useful to <emph>complete</emph> an existing entry with fetched information.
* May return multiple search hits.
*/
public interface EntryBasedFetcher extends WebFetcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* Searches web resources for bibliographic information based on an identifier.
* Examples are ISBN numbers and DOIs.
*/
public interface IdBasedFetcher extends WebFetcher {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
/**
* Searches web resources for bibliographic information based on a free-text query.
* May return multiple search hits.
* <p>
* This interface is used for web resources which directly return BibTeX data ({@link BibEntry})
* </p>
*/
public interface SearchBasedFetcher extends WebFetcher {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,25 @@
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;

/**
* Provides a convenient interface for search-based fetcher, which follow the usual three-step procedure:
* Provides a convenient interface for search-based fetcher, which follows the usual three-step procedure:
* <ol>
* <li>Open a URL based on the search query</li>
* <li>Parse the response to get a list of {@link BibEntry}</li>
* <li>Post-process fetched entries</li>
* </ol>
* <p>
* This interface is used for web resources which do NOT provide BibTeX data (@link {@link BibEntry)}.
* JabRef's infrastructure to convert arbitrary input data to BibTeX is {@link Parser}.
* </p>
* <p>
* This interface inherits {@link SearchBasedFetcher}, because the methods <code>performSearch</code> have to be provided by both.
* As non-BibTeX web fetcher one could do "magic" stuff without this helper interface and directly use {@link WebFetcher}, but this is more work.
* </p>
* <p>
* Note that this interface "should" be an abstract class.
* However, Java does not support multi inheritance with classes (but with interfaces).
* We need multi inheritance, because a fetcher might implement multiple query types (such as id fetching {@link IdBasedFetcher)}, complete entry {@link EntryBasedFetcher}, and search-based fetcher (this class).
* </p>
*/
public interface SearchBasedParserFetcher extends SearchBasedFetcher {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public List<String> parseDoiSearchPage(InputStream stream) throws ParseException
Elements doiHrefs = doc.select("div.issue-item__content-right > h5 > span > a");

for (Element elem : doiHrefs) {
String fullSegement = elem.attr("href");
String doi = fullSegement.substring(fullSegement.indexOf("10"));
String fullSegment = elem.attr("href");
String doi = fullSegment.substring(fullSegment.indexOf("10"));
doiList.add(doi);
}
} catch (IOException ex) {
Expand Down

0 comments on commit 3c247ff

Please sign in to comment.