Skip to content

Commit 7620e78

Browse files
committed
Initial commit
0 parents  commit 7620e78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6889
-0
lines changed

.gitignore

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Java template
3+
# Compiled class file
4+
# Log file
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Mobile Tools for Java (J2ME)
11+
.mtj.tmp/
12+
13+
# Package Files #
14+
*.jar
15+
*.war
16+
*.nar
17+
*.ear
18+
*.zip
19+
*.tar.gz
20+
*.rar
21+
22+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23+
hs_err_pid*
24+
### Gradle template
25+
.gradle
26+
/build/
27+
28+
# Ignore Gradle GUI config
29+
gradle-app.setting
30+
31+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
32+
!gradle-wrapper.jar
33+
34+
# Cache of project
35+
.gradletasknamecache
36+
37+
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
38+
# gradle/wrapper/gradle-wrapper.properties
39+
### NetBeans template
40+
nbproject/private/
41+
build/
42+
nbbuild/
43+
dist/
44+
nbdist/
45+
.nb-gradle/
46+
### Eclipse template
47+
48+
.metadata
49+
bin/
50+
tmp/
51+
*.tmp
52+
*.bak
53+
*.swp
54+
*~.nib
55+
local.properties
56+
.settings/
57+
.loadpath
58+
.recommenders
59+
60+
# External tool builders
61+
.externalToolBuilders/
62+
63+
# Locally stored "Eclipse launch configurations"
64+
*.launch
65+
66+
# PyDev specific (Python IDE for Eclipse)
67+
*.pydevproject
68+
69+
# CDT-specific (C/C++ Development Tooling)
70+
.cproject
71+
72+
# CDT- autotools
73+
.autotools
74+
75+
# Java annotation processor (APT)
76+
.factorypath
77+
78+
# PDT-specific (PHP Development Tools)
79+
.buildpath
80+
81+
# sbteclipse plugin
82+
.target
83+
84+
# Tern plugin
85+
.tern-project
86+
87+
# TeXlipse plugin
88+
.texlipse
89+
90+
# STS (Spring Tool Suite)
91+
.springBeans
92+
93+
# Code Recommenders
94+
.recommenders/
95+
96+
# Scala IDE specific (Scala & Java development for Eclipse)
97+
.cache-main
98+
.scala_dependencies
99+
.worksheet
100+
### Maven template
101+
target/
102+
pom.xml.tag
103+
pom.xml.releaseBackup
104+
pom.xml.versionsBackup
105+
pom.xml.next
106+
release.properties
107+
dependency-reduced-pom.xml
108+
buildNumber.properties
109+
.mvn/timing.properties
110+
111+
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
112+
!/.mvn/wrapper/maven-wrapper.jar
113+
### JetBrains template
114+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
115+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
116+
117+
# User-specific stuff
118+
.idea/**/workspace.xml
119+
.idea/**/tasks.xml
120+
.idea/**/dictionaries
121+
.idea/**/shelf
122+
123+
# Sensitive or high-churn files
124+
.idea/**/dataSources/
125+
.idea/**/dataSources.ids
126+
.idea/**/dataSources.local.xml
127+
.idea/**/sqlDataSources.xml
128+
.idea/**/dynamic.xml
129+
.idea/**/uiDesigner.xml
130+
.idea/**/dbnavigator.xml
131+
132+
# Gradle
133+
.idea/**/gradle.xml
134+
.idea/**/libraries
135+
136+
# CMake
137+
cmake-build-debug/
138+
cmake-build-release/
139+
140+
# Mongo Explorer plugin
141+
.idea/**/mongoSettings.xml
142+
143+
# File-based project format
144+
*.iws
145+
146+
# IntelliJ
147+
out/
148+
149+
# mpeltonen/sbt-idea plugin
150+
.idea_modules/
151+
152+
# JIRA plugin
153+
atlassian-ide-plugin.xml
154+
155+
# Cursive Clojure plugin
156+
.idea/replstate.xml
157+
158+
# Crashlytics plugin (for Android Studio and IntelliJ)
159+
com_crashlytics_export_strings.xml
160+
crashlytics.properties
161+
crashlytics-build.properties
162+
fabric.properties
163+
164+
# Editor-based Rest Client
165+
.idea/httpRequests

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Alexander Söderberg
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# EventBus
2+
A simple and effective subscription based event bus written in Java
3+
4+
#### What can it do?
5+
EventBus support synchronous and asynchronous event dispatching. Events may be
6+
cancellable. Events are dispatched to annotated subscriber methods.
7+
8+
#### How does it work?
9+
EventBus used lambda meta factories to access subscriber methods without reflection, using
10+
the [lambda-factory](https://github.com/Hervian/lambda-factory/) library. Any object can
11+
be dispatched as an event, and a method accepting a single parameter will be able to act on
12+
the event.
13+
14+
#### How to use it?
15+
16+
Create an event bus:
17+
```java
18+
final EventBus bus = new SimpleEventBus();
19+
```
20+
21+
Create a listener:
22+
```java
23+
public static final class TestListenerClass {
24+
@Listener public void onString(final String string) {
25+
new RuntimeException("Found a string: " + string).printStackTrace();
26+
indicateSuccess = true;
27+
}
28+
}
29+
```
30+
31+
Register the listener:
32+
```java
33+
bus.registerListeners(new TestListenerClass());
34+
```
35+
36+
Dispatch an event:
37+
```java
38+
final String event = "Hello World!";
39+
bus.throwSync(event);
40+
```
41+
42+
and that is it. Events can also be dispatched asynchronously, by using `throwAsync`.
43+
44+
JavaDoc can be found in the [docs](https://github.com/Sauilitired/EventBus/tree/master/docs/) directory.
45+
46+
#### Maven
47+
EventBus is using the JitPack maven repository.
48+
49+
![JitPack Badge](https://jitpack.io/v/Sauilitired/EventBus.svg)
50+
51+
To use it, add the following repository:
52+
```xml
53+
<repository>
54+
<id>jitpack.io</id>
55+
<url>https://jitpack.io</url>
56+
</repository>
57+
```
58+
and the following dependency:
59+
```xml
60+
<dependency>
61+
<groupId>com.github.Sauilitired</groupId>
62+
<artifactId>EventBus</artifactId>
63+
<version>1.0-SNAPSHOT</version>
64+
</dependency>
65+
```
66+
67+
### Contributions &amp; Contact
68+
Contributions are very welcome! The project uses the
69+
[Google Java](https://google.github.io/styleguide/javaguide.html) code style. The project is licensed
70+
under the MIT license.
71+
72+
If you have any further questions or feedback, then feel free to join our [Discord](https://discord.gg/ngZCzbU).\
73+
If the project helped you, then you are free to give me some coffee money via [PayPal](https://www.paypal.me/Sauilitired)
74+
:coffee:

build.gradle

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
maven { url "https://plugins.gradle.org/m2/" }
5+
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
6+
jcenter()
7+
}
8+
dependencies {
9+
classpath 'gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.14.0'
10+
}
11+
}
12+
13+
apply plugin: 'java'
14+
apply plugin: 'com.github.hierynomus.license'
15+
16+
group 'org.incendo'
17+
version '1.0-SNAPSHOT'
18+
19+
sourceCompatibility = 1.8
20+
targetCompatibility = 1.8
21+
22+
license {
23+
mapping {
24+
java = 'DOUBLESLASH_STYLE'
25+
}
26+
}
27+
28+
repositories {
29+
maven { url "https://jitpack.io" }
30+
mavenCentral()
31+
}
32+
33+
dependencies {
34+
// Mostly used for its awesome map implementations
35+
compile group: 'com.google.guava', name: 'guava', version: '23.2-jre'
36+
// Lambda-factory
37+
compile 'com.github.Hervian:lambda-factory:91bc62f8c2'
38+
// Used to simplify code creation
39+
compileOnly 'org.projectlombok:lombok:1.18.4'
40+
41+
testCompileOnly 'org.projectlombok:lombok:1.18.4'
42+
compile group: 'org.jetbrains', name: 'annotations', version: '16.0.3'
43+
testCompile 'org.junit.jupiter:junit-jupiter-api:5.3.2'
44+
testCompile(
45+
'org.junit.jupiter:junit-jupiter-engine:5.3.2',
46+
'org.junit.vintage:junit-vintage-engine:5.3.2',
47+
'org.junit.platform:junit-platform-launcher:1.3.2',
48+
'org.junit.platform:junit-platform-runner:1.3.2'
49+
)
50+
}
51+
52+
build.dependsOn(licenseFormatMain)

docs/allclasses-frame.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<!-- NewPage -->
3+
<html lang="en">
4+
<head>
5+
<!-- Generated by javadoc (1.8.0_191) on Fri Jan 25 19:48:49 CET 2019 -->
6+
<title>All Classes</title>
7+
<meta name="date" content="2019-01-25">
8+
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
9+
<script type="text/javascript" src="script.js"></script>
10+
</head>
11+
<body>
12+
<h1 class="bar">All&nbsp;Classes</h1>
13+
<div class="indexContainer">
14+
<ul>
15+
<li><a href="org/incendo/events/Cancellable.html" title="interface in org.incendo.events" target="classFrame"><span class="interfaceName">Cancellable</span></a></li>
16+
<li><a href="org/incendo/events/EventBus.html" title="class in org.incendo.events" target="classFrame">EventBus</a></li>
17+
<li><a href="org/incendo/events/Listener.html" title="annotation in org.incendo.events" target="classFrame">Listener</a></li>
18+
<li><a href="org/incendo/events/ListenerMethod.html" title="class in org.incendo.events" target="classFrame">ListenerMethod</a></li>
19+
<li><a href="org/incendo/events/reflection/ReflectionUtils.html" title="class in org.incendo.events.reflection" target="classFrame">ReflectionUtils</a></li>
20+
<li><a href="org/incendo/events/reflection/ReflectionUtils.AnnotatedMethod.html" title="class in org.incendo.events.reflection" target="classFrame">ReflectionUtils.AnnotatedMethod</a></li>
21+
<li><a href="org/incendo/events/SimpleEventBus.html" title="class in org.incendo.events" target="classFrame">SimpleEventBus</a></li>
22+
</ul>
23+
</div>
24+
</body>
25+
</html>

docs/allclasses-noframe.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<!-- NewPage -->
3+
<html lang="en">
4+
<head>
5+
<!-- Generated by javadoc (1.8.0_191) on Fri Jan 25 19:48:49 CET 2019 -->
6+
<title>All Classes</title>
7+
<meta name="date" content="2019-01-25">
8+
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
9+
<script type="text/javascript" src="script.js"></script>
10+
</head>
11+
<body>
12+
<h1 class="bar">All&nbsp;Classes</h1>
13+
<div class="indexContainer">
14+
<ul>
15+
<li><a href="org/incendo/events/Cancellable.html" title="interface in org.incendo.events"><span class="interfaceName">Cancellable</span></a></li>
16+
<li><a href="org/incendo/events/EventBus.html" title="class in org.incendo.events">EventBus</a></li>
17+
<li><a href="org/incendo/events/Listener.html" title="annotation in org.incendo.events">Listener</a></li>
18+
<li><a href="org/incendo/events/ListenerMethod.html" title="class in org.incendo.events">ListenerMethod</a></li>
19+
<li><a href="org/incendo/events/reflection/ReflectionUtils.html" title="class in org.incendo.events.reflection">ReflectionUtils</a></li>
20+
<li><a href="org/incendo/events/reflection/ReflectionUtils.AnnotatedMethod.html" title="class in org.incendo.events.reflection">ReflectionUtils.AnnotatedMethod</a></li>
21+
<li><a href="org/incendo/events/SimpleEventBus.html" title="class in org.incendo.events">SimpleEventBus</a></li>
22+
</ul>
23+
</div>
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)