Package page.codeberg.friedolyn.client
Class HeadlessBrowser.FetchClearname
java.lang.Object
page.codeberg.friedolyn.util.Task<String>
page.codeberg.friedolyn.client.FriedolinClient.FetchClearname
page.codeberg.friedolyn.client.HeadlessBrowser.FetchClearname
-
Nested Class Summary
Nested classes/interfaces inherited from class page.codeberg.friedolyn.util.Task
Task.CancelListener, Task.FailureListener<ResultType>, Task.ProgressListener, Task.SuccessListener<ResultType>, Task.TaskListener<ResultType> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether the task was prematurelyterminatedby outside intervention.private final @NonNull HashSet<Task.TaskListener<String>> The subscribers interested in the progress and status updates of this task.private StringThe student'sclear namefetched from Friedolin.private BooleanWhether fetching the student'sclear namewas successful.static final @lombok.NonNull int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Prematurely terminates the action.private voidNotifies allsubscribersthat fetching the student's clear name has been prematurelyterminatedby outside intervention.private voidfailed()Notifies allsubscribersthat fetching the student's clear name has finished unsuccessfully.voidregisterListener(@NonNull Task.TaskListener<String> taskListener) Adds a subscriber that is interested in status updates of the action's progress.booleanremoveListener(@NonNull Task.TaskListener<String> taskListener) Removes a subscriber that was previously added to receive status updates of the action's progress.voidrun()Begins the execution of the action.private voidstarted()Notifies allsubscribersthat fetching the student's clear name has begun.private voidNotifies allsubscribersthat fetching the student's clear name has succeeded.private voidupdateProgress(int current, int total) Notifies allsubscribersabout the progress of this task.Methods inherited from class page.codeberg.friedolyn.util.Task
setOnCancelled, setOnFailed, setOnProgressUpdate, setOnSucceeded
-
Field Details
-
TOTAL_WORK
@NonNull public static final @lombok.NonNull int TOTAL_WORK- See Also:
-
LISTENERS
The subscribers interested in the progress and status updates of this task. -
result
The student'sclear namefetched from Friedolin.nulluntil the task has succeeded. -
success
Whether fetching the student'sclear namewas successful.nulluntil the task has finished. -
isCancelled
private boolean isCancelledWhether the task was prematurelyterminatedby outside intervention.
-
-
Constructor Details
-
FetchClearname
public FetchClearname()
-
-
Method Details
-
updateProgress
private void updateProgress(int current, int total) Notifies allsubscribersabout the progress of this task.- Parameters:
current- The amount of work that has been done so far.total- The total number of steps required to complete this task.
-
started
private void started()Notifies allsubscribersthat fetching the student's clear name has begun. -
succeeded
private void succeeded()Notifies allsubscribersthat fetching the student's clear name has succeeded. -
failed
private void failed()Notifies allsubscribersthat fetching the student's clear name has finished unsuccessfully. -
cancelled
private void cancelled()Notifies allsubscribersthat fetching the student's clear name has been prematurelyterminatedby outside intervention. -
cancel
-
registerListener
Adds a subscriber that is interested in status updates of the action's progress. Does NOT remove or replace any existing listeners.- Specified by:
registerListenerin classTask<String>- Parameters:
taskListener- The subscriber that wants to be informed about the progress of the action.- See Also:
-
removeListener
Removes a subscriber that was previously added to receive status updates of the action's progress.- Specified by:
removeListenerin classTask<String>- Parameters:
taskListener- The subscriber that no longer wants to be informed about the progress of the action. Must be the exact same reference that was previously registered.- Returns:
trueif the subscriber was removed,falseif it hadn't been registered in the first place.- See Also:
-
run
Begins the execution of the action. The action will run in the same thread that it was envoked from. UseTask.cancel()to prematurely terminate the action. The end product of the action can be retrieved usingTask.getResult(). -
getResult
- Specified by:
getResultin classTask<String>- Returns:
- The end product generated by the action. Empty if the action has not finished yet.
The presence of
Result.getResult()does NOT indicate success. OnlyResult.getSuccess()can be used to determine success or failure.
-