epoxy-processor / com.airbnb.epoxy.processor / ResourceProcessor

ResourceProcessor

class ResourceProcessor

Scans R files and and compiles resource values in those R classes. This allows us to look up raw resource values (eg 23523452) and convert that to the resource name (eg R.layout.my_view) so that we can properly reference that resource. This is important in library projects where the R value at process time can be different from the final R value in the app.

This is adapted from Butterknife. https://github.com/JakeWharton/butterknife/pull/613

Properties

rClassNames

val rClassNames: List<ClassName>

trees

val trees: Trees?

Functions

getAlternateLayouts

fun getAlternateLayouts(layout: ResourceValue): List<ResourceValue>

Returns a list of layout resources whose name contains the given layout as a prefix.

getLayoutInAnnotation

fun getLayoutInAnnotation(element: Element, annotationClass: Class<out Annotation>): ResourceValue

getLayoutsInAnnotation

fun getLayoutsInAnnotation(element: Element, annotationClass: Class<out Annotation>): List<ResourceValue>

Get detailed information about the layout resources that are parameters to the given annotation.

getResourceInAnnotation

fun getResourceInAnnotation(element: Element, annotationClass: Class<*>, resourceType: String?, resourceValue: Int): ResourceValue

getResourcesInAnnotation

fun getResourcesInAnnotation(element: Element, annotationClass: Class<*>, resourceType: String?, resourceValues: List<Int>): List<ResourceValue>

getStringResourceInAnnotation

fun getStringResourceInAnnotation(element: Element, annotationClass: Class<*>, resourceValue: Int): ResourceValue

Extension Functions

mutex

fun Any.mutex(): Mutex