EJE provides accessible methods for handling events/actions/listeners

Overview

Easy-Java-Events

EJE provides accessible methods for handling events/actions/listeners. Add this as dependency to your project via Maven/Gradle/Sbt/Leinigen (requires Java 8 or higher).

{ System.out.println("New value: "+value+" bye!"); }, Exception::printStackTrace); onValueChanged.execute(7); // Prints out "New value: 7" and "New value: 7 bye!" // If more and more actions get added over time // you must remove unused actions. There are some util methods for this case. // First we create a new action with additional params: isOneTime=false and object=null. Action actionToRemove = onValueChanged.addAction(value -> { System.out.println("New value: "+value+", but I will be gone soon :/"); }, Exception::printStackTrace, false, null); // Then we initialise the cleaner thread for this event, which checks // its actions list every second for actions that // fulfill the condition "object != null" and removes those. onValueChanged.initCleaner(1000, object -> object != null, Exception::printStackTrace); // Once we want to remove the action, we simply give it an object that is not null. // The cleaner then removes it in the next check. actionToRemove.object = new Object(); // Note that you can store any type of object here.">
Event<Integer> onValueChanged = new Event<>();
onValueChanged.addAction(value -> { // Stays in memory and gets executed every time.
    System.out.println("New value: "+value);
    // You can throw exceptions in here
}, Exception::printStackTrace); // and catch them here.

onValueChanged.execute(10); // Prints out "New value: 10"
onValueChanged.execute(5); // Prints out "New value: 5"

// One time actions that only get executed once, are also supported:
onValueChanged.addOneTimeAction(value -> {
    System.out.println("New value: "+value+" bye!");
}, Exception::printStackTrace);

onValueChanged.execute(7); // Prints out "New value: 7" and "New value: 7 bye!"

// If more and more actions get added over time
// you must remove unused actions. There are some util methods for this case.
// First we create a new action with additional params: isOneTime=false and object=null.
Action<Integer> actionToRemove = onValueChanged.addAction(value -> {
    System.out.println("New value: "+value+", but I will be gone soon :/");
}, Exception::printStackTrace, false, null);

// Then we initialise the cleaner thread for this event, which checks
// its actions list every second for actions that
// fulfill the condition "object != null" and removes those.
onValueChanged.initCleaner(1000, object -> object != null, Exception::printStackTrace);

// Once we want to remove the action, we simply give it an object that is not null.
// The cleaner then removes it in the next check.
actionToRemove.object = new Object(); // Note that you can store any type of object here.
You might also like...

The state-of-the-art Dashboard of Apache RoccketMQ provides excellent monitoring capability. Various graphs and statistics of events, performance and system information of clients and application is evidently made available to the user.

RocketMQ Dashboard How To Install With Docker get docker image mvn clean package -Dmaven.test.skip=true docker:build or docker pull apacherocketmq/ro

Dec 30, 2022

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!

OPEN HTML TO PDF OVERVIEW Open HTML to PDF is a pure-Java library for rendering arbitrary well-formed XML/XHTML (and even HTML5) using CSS 2.1 for lay

Dec 29, 2022

Accessible GUI-driven robot programming for your product

Accessible GUI-driven robot programming for your product

Accessible GUI-driven robot programming for your product Description Roblocks is an accessible Graphical Programming Tool which enables basic robot pr

Sep 19, 2022

Z is a Java library providing accessible, consistent function combinators.

Fearless function combination in Java Techniques Unlock your functional programming potential with these combination techniques: Fusion Z.fuse(fn1, fn

Jun 13, 2022

Jiskord is a selfbot wrapper for Discord with almost every API endpoint accessible

Jiskord Jiskord is a selfbot wrapper for Discord with almost every API endpoint accessible. This library is inspired by Discum. It is made using Java

Feb 28, 2022

This simple Android Studio plugin includes keyboard shortcuts for many common actions.

This simple Android Studio plugin includes keyboard shortcuts for many common actions.

Hotkeys This simple Android Studio plugin includes keyboard shortcuts for many common actions. Features • Build process • Contribute • License Feature

Apr 26, 2022

Nightmare-text - This is a simple lib that help to create, titles, actionbars, hovers and click actions chat components.

Nightmare text This is a simple lib that help to create, titles, actionbars, hovers and click actions chat components. Setup public final class Testin

Mar 9, 2022

jedibot is an application that aims to do beneficial actions on the Ethereum blockchain for the DeFi ecosystem while earning a profit for the user.

jedibot is an application that aims to do beneficial actions on the Ethereum blockchain for the DeFi ecosystem while earning a profit for the user. These actions include maintaining the DAI peg, providing liquidity and liquidating undercollateralized assets.

Feb 5, 2022

Develop your GitHub Actions in Java with Quarkus

Develop your GitHub Actions in Java with Quarkus

Quarkus GitHub Action Develop your GitHub Actions in Java with Quarkus Interested in GitHub Apps? Have a look at the Quarkus GitHub App extension. Qua

Jan 6, 2023

I had too much coffee and decided to mirror my actions by writing too many programs in Java.

Raging Coffee Table of Contents Description Running the Programs Extra Dependencies Roadmap Further Reading Known Issues Resources Contributions Descr

Dec 15, 2022

Apache Log4j 2 is an upgrade to Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture.

Apache Log4j 2 Apache Log4j 2 is an upgrade to Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides many of the

Jan 4, 2023

JLine is a Java library for handling console input.

JLine JLine is a Java library for handling console input. It is similar in functionality to BSD editline and GNU readline but with additional features

Jan 5, 2023

A library that simplifies error handling for Functional Programming in Java

A library that simplifies error handling for Functional Programming in Java

Faux Pas: Error handling in Functional Programming Faux pas noun, /fəʊ pɑː/: blunder; misstep, false step Faux Pas is a library that simplifies error

Dec 5, 2022

Java library for handling exceptions in concise, unified, and architecturally clean way.

NoException NoException is a Java library for handling exceptions in concise, unified, and architecturally clean way. System.out.println(Exceptions.lo

Nov 17, 2022

A library that simplifies error handling for Functional Programming in Java

A library that simplifies error handling for Functional Programming in Java

Faux Pas: Error handling in Functional Programming Faux pas noun, /fəʊ pɑː/: blunder; misstep, false step Faux Pas is a library that simplifies error

Dec 5, 2022

High Performance data structures and utility methods for Java

Agrona Agrona provides a library of data structures and utility methods that are a common need when building high-performance applications in Java. Ma

Dec 31, 2022

Log analyser / visualiser for Java HotSpot JIT compiler. Inspect inlining decisions, hot methods, bytecode, and assembly. View results in the JavaFX user interface.

JITWatch Log analyser and visualiser for the HotSpot JIT compiler. Video introduction to JITWatch video Slides from my LJC lightning talk on JITWatch

Jan 3, 2023
Releases(1.8.0)
Owner
Osiris-Team
Cooking some delicious code...
Osiris-Team
Jiskord is a selfbot wrapper for Discord with almost every API endpoint accessible

Jiskord Jiskord is a selfbot wrapper for Discord with almost every API endpoint accessible. This library is inspired by Discum. It is made using Java

Vinesh Rajpurohit 5 Feb 28, 2022
Develop your GitHub Actions in Java with Quarkus

Quarkus GitHub Action Develop your GitHub Actions in Java with Quarkus Interested in GitHub Apps? Have a look at the Quarkus GitHub App extension. Qua

Quarkiverse Hub 7 Jan 6, 2023
This library provides facilities to match an input string against a collection of regex patterns.

This library provides facilities to match an input string against a collection of regex patterns. This library acts as a wrapper around the popular Chimera library, which allows it to be used in Java.

Sahab 5 Oct 26, 2022
This API provides functionalities to lookup and manage user accounts

This API provides functionalities to lookup and manage user accounts. Any human or computer system that will interact with any of the API's requires being authenticated as a user. The API allows for common functionalities such as creating a new user account, resetting passwords and generating JWT tokens.

Narek Naltakyan 1 Jan 22, 2022
Backend for Saunah Management App provides a REST-API for the Saunah management app

?? ?? Saunah Backend Backend for Saunah Management App. This application provides a REST-API for the Saunah management app. ????‍?? Technology Stack T

null 2 Jun 13, 2022
A Java Telegram bot that provides thirukkural in tamil, english translations with all information!

A Java Telegram bot that provides thirukkural in tamil, english translations with all information!

VINU 5 Oct 19, 2022
Numerical-methods-using-java - Source Code for 'Numerical Methods Using Java' by Haksun Li

Apress Source Code This repository accompanies Numerical Methods Using Java by Haksun Li (Apress, 2022). Download the files as a zip using the green b

Apress 5 Nov 20, 2022
Output Keycloak Events and Admin Events to a Kafka topic.

keycloak-kafka-eventlistener Output Keycloak Events and Admin Events to a Kafka topic. Based on Keycloak 15.0.2+ / RH-SSO 7.5.0+ How to use the plugin

Dwayne Du 4 Oct 10, 2022
uniVocity-parsers is a suite of extremely fast and reliable parsers for Java. It provides a consistent interface for handling different file formats, and a solid framework for the development of new parsers.

Welcome to univocity-parsers univocity-parsers is a collection of extremely fast and reliable parsers for Java. It provides a consistent interface for

univocity 874 Dec 15, 2022
Juerr is a Java port of the uerr crate, it provides stunning visual error handling.

Juerr Juerr is a Java port of the uerr crate, it provides stunning visual error handling. Showcase Using the code below, we can display a simple error

IkeVoodoo 3 Jul 17, 2022