Skip to content

Commit

Permalink
Added default classes for accessors
Browse files Browse the repository at this point in the history
  • Loading branch information
ya-ilya committed Aug 15, 2023
1 parent 5b06317 commit eec9d08
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ import org.progreso.api.Api
* ```
*/
interface ChatAccessor {
open class Default : ChatAccessor {
override fun send(message: Any) {}
override fun info(message: Any) {}
override fun warn(message: Any) {}
override fun error(message: Any) {}
override fun addToSentMessages(message: Any) {}
}

/**
* Send message to the chat
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ package org.progreso.api.accessor
* ```
*/
interface EventAccessor {
open class Default : EventAccessor {
override fun register(instance: Any) {}
override fun unregister(instance: Any) {}
}

/**
* Register an object in event system
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ package org.progreso.api.accessor
* ```
*/
interface LoggerAccessor {
open class Default : LoggerAccessor {
override fun debug(message: String) {}
override fun info(message: String) {}
override fun warn(message: String, throwable: Throwable?) {}
override fun error(message: String, throwable: Throwable?) {}
}

/**
* Log message with DEBUG log-level
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ package org.progreso.api.accessor
* ```
*/
interface TextAccessor {
open class Default : TextAccessor {
override fun i18n(key: String, vararg args: Any) = key
}

/**
* Get internationalization by [key]
*
Expand Down

0 comments on commit eec9d08

Please sign in to comment.