kr.summitsystems.springbukkit.command.CommandExceptionHandlerRegistryImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-bukkit-command Show documentation
Show all versions of spring-bukkit-command Show documentation
Springframework based Bukkit plugin development kit.
The newest version!
package kr.summitsystems.springbukkit.command
import org.springframework.beans.factory.config.BeanDefinition
import org.springframework.context.annotation.Role
import org.springframework.core.convert.TypeDescriptor
import org.springframework.stereotype.Component
@Component
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
internal class CommandExceptionHandlerRegistryImpl : CommandExceptionHandlerRegistry {
private val handlers: MutableMap = mutableMapOf()
override fun addExceptionHandler(registrableCommandExceptionHandler: RegistrableCommandExceptionHandler) {
handlers[registrableCommandExceptionHandler.throwableType] = registrableCommandExceptionHandler
}
override fun find(throwableType: TypeDescriptor): RegistrableCommandExceptionHandler? {
return handlers[throwableType]
}
override fun getOrderedExceptionHandlers(): List {
return handlers
.values
.sortedBy {
it.order
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy