Skip to content

Instantly share code, notes, and snippets.

@danielgomezrico
Last active August 14, 2018 11:18
Show Gist options
  • Save danielgomezrico/3ac2317c04ee2e60dc50 to your computer and use it in GitHub Desktop.
Save danielgomezrico/3ac2317c04ee2e60dc50 to your computer and use it in GitHub Desktop.
Android / Kotlin - Typedef Annotations example
import android.support.annotation.IntDef
import kotlin.annotation.AnnotationRetention
class MyClass {
companion object {
const val ITEM_SERVICES = 0L
const val ITEM_PORTFOLIO = 1L
}
@IntDef(ITEM_SERVICES, ITEM_PORTFOLIO)
@Retention(AnnotationRetention.SOURCE)
annotation class ITEM
}
@budioktaviyan
Copy link

budioktaviyan commented Aug 25, 2017

How to call it in the implementation class ?

@jimmyFlash
Copy link

you're defined constants are of type Long @IntDef expects Int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment