Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
whyoleg committed Aug 14, 2024
1 parent c81f7f2 commit bb1fdac
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sweetspi-runtime/src/commonMain/kotlin/ServiceLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,25 @@ public annotation class ServiceProvider(
public vararg val services: KClass<*>,
)

// to be interoperable with the jvm service loader
// doesn't require to have `Service` annotation
@Repeatable
@MustBeDocumented
@Target(AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
public annotation class JvmServiceProvider(
public val service: KClass<*>,
)

public interface S {}

public class SImpl : S by SImpl()

public sealed class ServiceList<T : Any> : List<T> {
public abstract fun asSequence(): Sequence<T>
public abstract fun reloadServices()
}

/**
* Provides functionality for dynamically loading service implementations using the Service Provider Interface (SPI) mechanism.
*
Expand Down

0 comments on commit bb1fdac

Please sign in to comment.