Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 1.34 KB

File metadata and controls

40 lines (33 loc) · 1.34 KB

Codegen ktx

This is a library with a small, extensible API which provides utility on code generation classes.

We copy this class into all the little internal libraries we make. We are tired of doing it. Now it's a library.

Integration

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add the dependency

implementation 'com.github.parimatchtech:codegen-ktx:0.1'

Docs

Element

  • get annotation mirrors by KClass Element.getAnnotationMirror(Nullable::class)
  • get annotation mirrors by Name Element.getAnnotationMirror(Nullable::class)
  • Element.asTypeElement
  • Element.asDeclaredType()

AnnotationMirror

  • get AnnotationValue by property name AnnotationMirror.getAnnotationValue(<Name>)
  • get annotation value by property AnnotationMirror.getAnnotationValueAsString(Annotation::property)
  • get annotation value by name AnnotationMirror.getAnnotationValueAsString(<Name>)

ProcessingEnvironment

  • ProcessingEnvironment.isHasOption(<key>)
  • ProcessingEnvironment.getRequireOption(<key>)
  • ProcessingEnvironment.getOptionsOrDefault(<key>, <default>)
  • ProcessingEnvironment.checkRequireOptions(String... keys)