Skip to content

Commit

Permalink
📝 Add javadoc for the most used classes/methods
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis committed Oct 31, 2022
1 parent 5d7878c commit 195148c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ private tailrec fun KSClassDeclaration.recursiveSealedObjectInstances(
//endregion

//region Reflect
fun <T : Any> KClass<T>.reflectSealedObjectInstances() = recursiveSealedObjectInstances()
/**
* @return the [Set] of [T] instances through reflection.
*/
fun <T : Any> KClass<T>.reflectSealedObjectInstances(): Set<T> = recursiveSealedObjectInstances()

private tailrec fun <T : Any> KClass<T>.recursiveSealedObjectInstances(
sealedSubclasses: List<KClass<out T>> = listOf(this),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,28 @@ import fr.smarquis.sealed.SealedObjectInstances.Visibility.Unspecified
import kotlin.reflect.KClass
import kotlin.reflect.KFunction1

/**
* This repeatable annotation is the main entry point to configure the generated sealed class extensions.
*/
@Repeatable
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
annotation class SealedObjectInstances(
/**
* Method name to access sealed object instances.
*/
val name: String = "sealedObjectInstances",
/**
* The collection type the generated method.
*/
val rawType: RawType = Set,
/**
* The visibility of the generated method.
*/
val visibility: Visibility = Unspecified,
/**
* The file name for the generated method. The default filename (when blank) will be the sealed class name with `$sealedObjectInstances` postfix.
*/
val fileName: String = "",
) {

Expand Down

0 comments on commit 195148c

Please sign in to comment.