
co.verisoft.fw.async.Subject Maven / Gradle / Ivy
/*
* (C) Copyright 2022 VeriSoft (http://www.verisoft.co)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package co.verisoft.fw.async;
/**
* Implementation of the Observer pattern.
* This implementation is tailored for the async operation of WebDriver.
* This interface assumes you are familiar with the observer pattern.
* To learn more about observers visit the wikipedia site
* The subject is closely coupled with the co.verisoft.selenium.framework.async.{@link Observer} class
* In this framework, the subject is implemented by co.verisoft.selenium.framework.async.{@link AsyncListenerImp}
* The interface was designed to be triggered without any data, rather serve as a trigger for async scripts to perform
* their async operation
*
* @author Nir Gallner @ www.VeriSoft.co
* @since 2.0.3
*/
public interface Subject {
/**
* Registers a new observer to be notified. Typically it adds an object which implements the Observer interface
* to an ArrayList. Once the observer is on the list, each invocation of notify will trigger an update for all
* observers on the list
*
* @param o Observer object to be added
*/
void register(Observer o);
/**
* Unregister an existing observer, and stop notifying the observer upon invocation of notifyObservers method
*
* @param o Observer object to be removed
*/
void unregister(Observer o);
/**
* Notify all observers when time is due to execute async
* Typically, when the implementation uses an ArrayList to keep track of all the observes, this method will
* loop through the list and activate the update method for each observer
*/
void notifyObservers();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy