name.remal.java.lang.Class-kotlin.Annotation.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common Show documentation
Show all versions of common Show documentation
Java & Kotlin tools: common
package name.remal
import name.remal.annotation.AnnotationUtils
import java.lang.annotation.ElementType
import java.lang.annotation.Inherited
import java.lang.reflect.AnnotatedElement
import java.lang.reflect.Method
val Class.isLangCoreAnnotation get() = AnnotationUtils.isLangCoreAnnotation(this)
val Class.isInherited: Boolean get() = null != getDeclaredAnnotation(Inherited::class.java)
val Class.canAnnotateTypes: Boolean get() = canAnnotate(ElementType.TYPE)
val Class.canAnnotateFields: Boolean get() = canAnnotate(ElementType.FIELD)
val Class.canAnnotateMethods: Boolean get() = canAnnotate(ElementType.METHOD)
val Class.canAnnotateParameters: Boolean get() = canAnnotate(ElementType.PARAMETER)
val Class.canAnnotateConstructors: Boolean get() = canAnnotate(ElementType.CONSTRUCTOR)
val Class.canAnnotateLocalVariables: Boolean get() = canAnnotate(ElementType.LOCAL_VARIABLE)
val Class.canAnnotateAnnotations: Boolean get() = canAnnotate(ElementType.ANNOTATION_TYPE)
val Class.canAnnotatePackages: Boolean get() = canAnnotate(ElementType.PACKAGE)
val Class.canAnnotateTypeParameters: Boolean get() = canAnnotate(ElementType.TYPE_PARAMETER)
val Class.canAnnotateTypeUses: Boolean get() = canAnnotate(ElementType.TYPE_USE)
val Class.attributeMethods: List get() = AnnotationUtils.getAttributeMethods(this)
fun Class.canAnnotate(elementType: ElementType) = AnnotationUtils.canAnnotate(this, elementType)
fun Class.canAnnotate(element: AnnotatedElement) = AnnotationUtils.canAnnotate(this, element)
fun Class.newAnnotationInstance(attributes: Map? = null) = AnnotationUtils.newAnnotationInstance(this, attributes)