diff options
author | therealbush <therealbush@users.noreply.github.com> | 2022-04-23 15:32:41 -0700 |
---|---|---|
committer | therealbush <therealbush@users.noreply.github.com> | 2022-04-23 15:32:41 -0700 |
commit | adc29fb685307385cfa9ebb813ad2bfb18bb7776 (patch) | |
tree | 59b27215bb4c0db457f321d030fef9ba0c55b7fc /src | |
parent | c12696bd528e891b9da126d3b92f3db089b4b6e6 (diff) | |
download | eventbus-kotlin-adc29fb685307385cfa9ebb813ad2bfb18bb7776.tar.gz eventbus-kotlin-adc29fb685307385cfa9ebb813ad2bfb18bb7776.tar.bz2 eventbus-kotlin-adc29fb685307385cfa9ebb813ad2bfb18bb7776.zip |
updated links
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/me/bush/eventbuskotlin/CancelledState.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/me/bush/eventbuskotlin/Config.kt | 10 | ||||
-rw-r--r-- | src/main/kotlin/me/bush/eventbuskotlin/Event.kt | 8 | ||||
-rw-r--r-- | src/main/kotlin/me/bush/eventbuskotlin/EventBus.kt | 12 | ||||
-rw-r--r-- | src/main/kotlin/me/bush/eventbuskotlin/Listener.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/me/bush/eventbuskotlin/Util.kt | 2 | ||||
-rw-r--r-- | src/test/kotlin/KotlinTest.kt | 2 |
7 files changed, 20 insertions, 26 deletions
diff --git a/src/main/kotlin/me/bush/eventbuskotlin/CancelledState.kt b/src/main/kotlin/me/bush/eventbuskotlin/CancelledState.kt index 861b9fd..a0e01c0 100644 --- a/src/main/kotlin/me/bush/eventbuskotlin/CancelledState.kt +++ b/src/main/kotlin/me/bush/eventbuskotlin/CancelledState.kt @@ -14,8 +14,6 @@ import kotlin.reflect.typeOf /** * A simple SAM interface for determining if an event (or any class) is cancellable. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) - * * @author bush * @since 1.0.0 */ @@ -25,8 +23,6 @@ internal fun interface CancelledState { * [event] should only ever be of the type that was passed * to [CancelledState.invoke], **or this will throw.** * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) - * * @return `true` if [event] is cancelled, `false` otherwise. */ fun isCancelled(event: Any): Boolean @@ -43,8 +39,6 @@ internal fun interface CancelledState { /** * Creates a [CancelledState] object for events of class [type]. - * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) */ operator fun invoke(type: KClass<*>, config: Config): CancelledState = CACHE.getOrPut(type) { // Default implementation for our event class. diff --git a/src/main/kotlin/me/bush/eventbuskotlin/Config.kt b/src/main/kotlin/me/bush/eventbuskotlin/Config.kt index f0e1120..bad5e79 100644 --- a/src/main/kotlin/me/bush/eventbuskotlin/Config.kt +++ b/src/main/kotlin/me/bush/eventbuskotlin/Config.kt @@ -8,7 +8,7 @@ import org.apache.logging.log4j.Logger /** * A class containing configuration options for an [EventBus]. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#creating-an-eventbus) * * @author bush * @since 1.0.0 @@ -18,7 +18,7 @@ data class Config( /** * The logger this [EventBus] will use to log errors, or [EventBus.debug] * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#logger) */ val logger: Logger = LOGGER, @@ -28,7 +28,7 @@ data class Config( * * [What is a Coroutine?](https://kotlinlang.org/docs/coroutines-overview.html) * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#parallelScope) */ val parallelScope: CoroutineScope = CoroutineScope(Dispatchers.Default), @@ -36,7 +36,7 @@ data class Config( * Whether this [EventBus] should try to find a "cancelled" field in events being listened for that * are not a subclass of [Event]. This is experimental, and should be set to `false` if problems arise. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#thirdpartyCompatibility) */ val thirdPartyCompatibility: Boolean = true, @@ -44,7 +44,7 @@ data class Config( * Whether listeners need to be annotated with [EventListener] to be subscribed to this [EventBus]. * This has no effect on anything else, and is just to improve code readability. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#annotationRequired) */ val annotationRequired: Boolean = false ) diff --git a/src/main/kotlin/me/bush/eventbuskotlin/Event.kt b/src/main/kotlin/me/bush/eventbuskotlin/Event.kt index 50f1131..6b96461 100644 --- a/src/main/kotlin/me/bush/eventbuskotlin/Event.kt +++ b/src/main/kotlin/me/bush/eventbuskotlin/Event.kt @@ -3,7 +3,7 @@ package me.bush.eventbuskotlin /** * A base class for events that can be cancelled. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#ththingtodo) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#creating-an-event) * * @author bush * @since 1.0.0 @@ -15,7 +15,7 @@ abstract class Event { * [Listener.receiveCancelled] will receive it. However, it can be set back to * `false`, and listeners will be able to receive it again. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#posting-an-event) */ var cancelled = false set(value) { @@ -25,14 +25,14 @@ abstract class Event { /** * Determines if this event can be [cancelled]. This does not have to return a constant value. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#creating-an-event) */ protected abstract val cancellable: Boolean /** * Sets [cancelled] to true. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#posting-an-event) */ fun cancel() { cancelled = true diff --git a/src/main/kotlin/me/bush/eventbuskotlin/EventBus.kt b/src/main/kotlin/me/bush/eventbuskotlin/EventBus.kt index eeb887d..e08ef14 100644 --- a/src/main/kotlin/me/bush/eventbuskotlin/EventBus.kt +++ b/src/main/kotlin/me/bush/eventbuskotlin/EventBus.kt @@ -21,7 +21,7 @@ class EventBus(private val config: Config = Config()) { * * This will not find top level members, use [register] instead. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#subscribing-an-object) * * @return `true` if [subscriber] was successfully subscribed, * `false` if it was already subscribed, or could not be. @@ -37,7 +37,7 @@ class EventBus(private val config: Config = Config()) { * * This will not remove top level listeners, use [unregister] instead. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#subscribing-an-object) * * @return `true` if [subscriber] was successfully unsubscribed, `false` if it was not subscribed. */ @@ -48,7 +48,7 @@ class EventBus(private val config: Config = Config()) { /** * Registers a [Listener] to this [EventBus]. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#creating-a-listener) */ fun register(listener: Listener): Boolean = listeners.computeIfAbsent(listener.type) { ListenerGroup(it, config) @@ -57,7 +57,7 @@ class EventBus(private val config: Config = Config()) { /** * Unregisters a [Listener] from this [EventBus]. Returns `true` if [Listener] was registered. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#creating-a-listener) */ fun unregister(listener: Listener): Boolean = listeners[listener.type]?.let { val contained = it.unregister(listener) @@ -80,7 +80,7 @@ class EventBus(private val config: Config = Config()) { * Sequential listeners are called in the order of [Listener.priority], and parallel listeners * are called after using [launch]. This method will not wait for parallel listeners to complete. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#posting-an-event) */ fun post(event: Any): Boolean = listeners[event::class]?.post(event) ?: false @@ -90,7 +90,7 @@ class EventBus(private val config: Config = Config()) { * * **This may cause a [ConcurrentModificationException] if [register] or [subscribe] is called in parallel.** * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin) * ``` * Subscribers: 5 * Listeners: 8 sequential, 21 parallel diff --git a/src/main/kotlin/me/bush/eventbuskotlin/Listener.kt b/src/main/kotlin/me/bush/eventbuskotlin/Listener.kt index bb78b75..7f92211 100644 --- a/src/main/kotlin/me/bush/eventbuskotlin/Listener.kt +++ b/src/main/kotlin/me/bush/eventbuskotlin/Listener.kt @@ -7,7 +7,7 @@ import kotlin.reflect.KClass * This class is not intended to be used externally, use [listener] instead. You *could* use this, * and it would work fine however you would have to specify the type explicitly. (ew!) * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#creating-an-event) * * @author bush * @since 1.0.0 @@ -30,7 +30,7 @@ class Listener @PublishedApi internal constructor( * or getter belonging to an object to be subscribed with [EventBus.subscribe], * or directly registered to an [EventBus] with [EventBus.register]. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#creating-an-event) * * @param T The **exact** (no inheritance) type of event to listen for. * @param priority The priority of this listener, high to low. @@ -52,7 +52,7 @@ inline fun <reified T : Any> listener( * or getter belonging to an object to be subscribed with [EventBus.subscribe], * or directly registered to an [EventBus] with [EventBus.register]. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#creating-an-event) * * @param type The **exact** (no inheritance) type of event to listen for. * @param priority The priority of this listener, high to low. diff --git a/src/main/kotlin/me/bush/eventbuskotlin/Util.kt b/src/main/kotlin/me/bush/eventbuskotlin/Util.kt index edad824..f576f4c 100644 --- a/src/main/kotlin/me/bush/eventbuskotlin/Util.kt +++ b/src/main/kotlin/me/bush/eventbuskotlin/Util.kt @@ -72,6 +72,6 @@ internal fun getListeners(subscriber: Any, config: Config) = runCatching { /** * An annotation that must be used to identify listeners if [Config.annotationRequired] is `true`. * - * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething) + * [Information and examples](https://github.com/therealbush/eventbus-kotlin#annotationRequired) */ annotation class EventListener diff --git a/src/test/kotlin/KotlinTest.kt b/src/test/kotlin/KotlinTest.kt index 136e7c8..cddf538 100644 --- a/src/test/kotlin/KotlinTest.kt +++ b/src/test/kotlin/KotlinTest.kt @@ -235,7 +235,7 @@ class KotlinTest { eventBus.unsubscribe(this) } - var called = false + private var called = false @EventListener val annotation = listener<Unit> { |