Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Citymonstret committed Jan 25, 2019
0 parents commit 7620e78
Show file tree
Hide file tree
Showing 52 changed files with 6,889 additions and 0 deletions.
165 changes: 165 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Created by .ignore support plugin (hsz.mobi)
### Java template
# Compiled class file
# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Gradle template
.gradle
/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
### NetBeans template
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
### Eclipse template

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# CDT- autotools
.autotools

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/dictionaries
.idea/**/shelf

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/
cmake-build-release/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Alexander Söderberg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# EventBus
A simple and effective subscription based event bus written in Java

#### What can it do?
EventBus support synchronous and asynchronous event dispatching. Events may be
cancellable. Events are dispatched to annotated subscriber methods.

#### How does it work?
EventBus used lambda meta factories to access subscriber methods without reflection, using
the [lambda-factory](https://github.com/Hervian/lambda-factory/) library. Any object can
be dispatched as an event, and a method accepting a single parameter will be able to act on
the event.

#### How to use it?

Create an event bus:
```java
final EventBus bus = new SimpleEventBus();
```

Create a listener:
```java
public static final class TestListenerClass {
@Listener public void onString(final String string) {
new RuntimeException("Found a string: " + string).printStackTrace();
indicateSuccess = true;
}
}
```

Register the listener:
```java
bus.registerListeners(new TestListenerClass());
```

Dispatch an event:
```java
final String event = "Hello World!";
bus.throwSync(event);
```

and that is it. Events can also be dispatched asynchronously, by using `throwAsync`.

JavaDoc can be found in the [docs](https://github.com/Sauilitired/EventBus/tree/master/docs/) directory.

#### Maven
EventBus is using the JitPack maven repository.

![JitPack Badge](https://jitpack.io/v/Sauilitired/EventBus.svg)

To use it, add the following repository:
```xml
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
```
and the following dependency:
```xml
<dependency>
<groupId>com.github.Sauilitired</groupId>
<artifactId>EventBus</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
```

### Contributions &amp; Contact
Contributions are very welcome! The project uses the
[Google Java](https://google.github.io/styleguide/javaguide.html) code style. The project is licensed
under the MIT license.

If you have any further questions or feedback, then feel free to join our [Discord](https://discord.gg/ngZCzbU).\
If the project helped you, then you are free to give me some coffee money via [PayPal](https://www.paypal.me/Sauilitired)
:coffee:
52 changes: 52 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.14.0'
}
}

apply plugin: 'java'
apply plugin: 'com.github.hierynomus.license'

group 'org.incendo'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8
targetCompatibility = 1.8

license {
mapping {
java = 'DOUBLESLASH_STYLE'
}
}

repositories {
maven { url "https://jitpack.io" }
mavenCentral()
}

dependencies {
// Mostly used for its awesome map implementations
compile group: 'com.google.guava', name: 'guava', version: '23.2-jre'
// Lambda-factory
compile 'com.github.Hervian:lambda-factory:91bc62f8c2'
// Used to simplify code creation
compileOnly 'org.projectlombok:lombok:1.18.4'

testCompileOnly 'org.projectlombok:lombok:1.18.4'
compile group: 'org.jetbrains', name: 'annotations', version: '16.0.3'
testCompile 'org.junit.jupiter:junit-jupiter-api:5.3.2'
testCompile(
'org.junit.jupiter:junit-jupiter-engine:5.3.2',
'org.junit.vintage:junit-vintage-engine:5.3.2',
'org.junit.platform:junit-platform-launcher:1.3.2',
'org.junit.platform:junit-platform-runner:1.3.2'
)
}

build.dependsOn(licenseFormatMain)
25 changes: 25 additions & 0 deletions docs/allclasses-frame.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_191) on Fri Jan 25 19:48:49 CET 2019 -->
<title>All Classes</title>
<meta name="date" content="2019-01-25">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1 class="bar">All&nbsp;Classes</h1>
<div class="indexContainer">
<ul>
<li><a href="org/incendo/events/Cancellable.html" title="interface in org.incendo.events" target="classFrame"><span class="interfaceName">Cancellable</span></a></li>
<li><a href="org/incendo/events/EventBus.html" title="class in org.incendo.events" target="classFrame">EventBus</a></li>
<li><a href="org/incendo/events/Listener.html" title="annotation in org.incendo.events" target="classFrame">Listener</a></li>
<li><a href="org/incendo/events/ListenerMethod.html" title="class in org.incendo.events" target="classFrame">ListenerMethod</a></li>
<li><a href="org/incendo/events/reflection/ReflectionUtils.html" title="class in org.incendo.events.reflection" target="classFrame">ReflectionUtils</a></li>
<li><a href="org/incendo/events/reflection/ReflectionUtils.AnnotatedMethod.html" title="class in org.incendo.events.reflection" target="classFrame">ReflectionUtils.AnnotatedMethod</a></li>
<li><a href="org/incendo/events/SimpleEventBus.html" title="class in org.incendo.events" target="classFrame">SimpleEventBus</a></li>
</ul>
</div>
</body>
</html>
25 changes: 25 additions & 0 deletions docs/allclasses-noframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_191) on Fri Jan 25 19:48:49 CET 2019 -->
<title>All Classes</title>
<meta name="date" content="2019-01-25">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1 class="bar">All&nbsp;Classes</h1>
<div class="indexContainer">
<ul>
<li><a href="org/incendo/events/Cancellable.html" title="interface in org.incendo.events"><span class="interfaceName">Cancellable</span></a></li>
<li><a href="org/incendo/events/EventBus.html" title="class in org.incendo.events">EventBus</a></li>
<li><a href="org/incendo/events/Listener.html" title="annotation in org.incendo.events">Listener</a></li>
<li><a href="org/incendo/events/ListenerMethod.html" title="class in org.incendo.events">ListenerMethod</a></li>
<li><a href="org/incendo/events/reflection/ReflectionUtils.html" title="class in org.incendo.events.reflection">ReflectionUtils</a></li>
<li><a href="org/incendo/events/reflection/ReflectionUtils.AnnotatedMethod.html" title="class in org.incendo.events.reflection">ReflectionUtils.AnnotatedMethod</a></li>
<li><a href="org/incendo/events/SimpleEventBus.html" title="class in org.incendo.events">SimpleEventBus</a></li>
</ul>
</div>
</body>
</html>
Loading

0 comments on commit 7620e78

Please sign in to comment.