getSourceAs

open fun <T : Source?> getSourceAs(@NonNull sourceId: String): T

Tries to cast the Source to T, throws ClassCastException if it's another type.

Return

the casted Source, null if another type

Parameters

sourceId

the id used to look up a layer

<T>

the generic type of a Source