All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kr.summitsystems.springbukkit.command.CommandAopUtils.kt Maven / Gradle / Ivy

The newest version!
package kr.summitsystems.springbukkit.command

import java.lang.reflect.Method
import java.lang.reflect.Parameter
import kotlin.coroutines.Continuation
import kotlin.reflect.KFunction
import kotlin.reflect.KParameter
import kotlin.reflect.full.valueParameters

object CommandAopUtils {
    /**
     * 
     *
     * first parameter: CommandContext parameter
     * last parameter: Continuation parameter (Coroutine)
     */
    internal fun extractCommandParameters(method: Method): List {
        return method.parameters
            .filter { parameter ->
                parameter.type != Continuation::class.java && parameter.type != CommandContext::class.java
            }
    }

    internal fun extractCommandParameters(method: KFunction<*>): List {
        return method.valueParameters
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy