Package com.ftpix.webwatcher
Class WebWatcher<T extends WebSite>
- java.lang.Object
-
- com.ftpix.webwatcher.WebWatcher<T>
-
-
Method Summary
Modifier and Type Method Description WebWatcher<T>
bodyOnly(boolean bodyOnly)
To set whether the content checking is only happening from the body tag and ignore changes in the header note that this parameter is overriden is aWebSite
has a css selectorvoid
check()
Trigger the website checkvoid
checkPeriodically(int intervalInSeconds)
trigger the website watch periodically (blocking)boolean
isCheckLoopRunning()
WebWatcher<T>
onChange(WebSiteListener<T> listener)
A listener to do something when the website changesWebWatcher<T>
onError(WebSiteErrorListener<T> errorListener)
a listener to handle errorsvoid
setCheckLoopRunning(boolean checkLoopRunning)
WebWatcher<T>
textOnly(boolean textOnly)
To set whether the content checking is only on the visible text (true) or the html structure (false)WebWatcher<T>
triggerEventOnFirstCheck(boolean triggerEvent)
Whetehr or not to trigger event if the website has never been checked beforestatic WebWatcher<DefaultWebSite>
watch(String... urls)
Watch a list of websitesstatic <U extends WebSite>
WebWatcher<U>watch(U... sites)
Watch a list of websites
-
-
-
Method Detail
-
watch
public static WebWatcher<DefaultWebSite> watch(String... urls)
Watch a list of websites- Parameters:
urls
- a list of URLs to watch- Returns:
- a new web watcher for the given websites
-
watch
public static <U extends WebSite> WebWatcher<U> watch(U... sites)
Watch a list of websites- Type Parameters:
U
- a class that implements a WebSote- Parameters:
sites
- a list of sites to watch- Returns:
- a new web watcher for the given websites
-
triggerEventOnFirstCheck
public WebWatcher<T> triggerEventOnFirstCheck(boolean triggerEvent)
Whetehr or not to trigger event if the website has never been checked before- Parameters:
triggerEvent
- the flag- Returns:
- itself
-
onChange
public WebWatcher<T> onChange(WebSiteListener<T> listener)
A listener to do something when the website changes- Parameters:
listener
- a listener to do something when a website changes- Returns:
- itself
-
onError
public WebWatcher<T> onError(WebSiteErrorListener<T> errorListener)
a listener to handle errors- Parameters:
errorListener
- an error listener to add to the watcher- Returns:
- itself
-
textOnly
public WebWatcher<T> textOnly(boolean textOnly)
To set whether the content checking is only on the visible text (true) or the html structure (false)- Parameters:
textOnly
- defaults to false- Returns:
- itself
-
bodyOnly
public WebWatcher<T> bodyOnly(boolean bodyOnly)
To set whether the content checking is only happening from the body tag and ignore changes in the header note that this parameter is overriden is aWebSite
has a css selector- Parameters:
bodyOnly
- defaults to false- Returns:
- itself
-
check
public void check()
Trigger the website check
-
isCheckLoopRunning
public boolean isCheckLoopRunning()
-
setCheckLoopRunning
public void setCheckLoopRunning(boolean checkLoopRunning)
-
checkPeriodically
public void checkPeriodically(int intervalInSeconds)
trigger the website watch periodically (blocking)- Parameters:
intervalInSeconds
- the delay in seconds between each checks
-
-