Hi, @blake.meike. Yes, allow me to elaborate. Without the type being public, I’m unable to declare it in my wrapper code. I’m working on a Kotlin Multiplatform API which wraps the underlying Kotlin/Java and Objective-C SDKs such that they can be used in a pure Kotlin KMM module. My wrapper API has a 1:1 representation of all types in the Couchbase Lite public API. This includes IndexConfiguration
because it’s part of Database
’s public API as a parameter to createIndex()
.
I need to declare the IndexConfiguration
type in order for my wrapper API to store an underlying IndexConfiguration
value in order to pass to the underlying Database.createIndex()
API. My wrapper IndexConfiguration
type serves as the unifying super type to both FullTextIndexConfiguration
and ValueIndexConfiguration
, the same as it does in the wrapped Couchbase Lite API.
Currently I have to use the nearest accessible public super type to declare as the type in my wrapper API (at least this is AbstractIndex
instead of Object
). Then I have to check the actual type of the AbstractIndex
value at runtime and cast it to either FullTextIndexConfiguration
or ValueIndexConfiguration
in order to pass to the underlying Database.createIndex()
API as the necessary IndexConfiguration
type.
Ideally, I should be able to declare the IndexConfiguration
type directly in my code. I have no need to call any of the restricted constructors or methods, only the class itself needs to be made public. It makes sense it should be a public type, as it’s part of Database
’s public API.
It looks a bit odd too in the documentation as is. The method shows the parameter as type com.couchbase.lite.IndexConfiguration config
, with no link to the type to figure out how to create such a value to pass to the API.
Additionally FullTextIndexConfiguration
and ValueIndexConfiguration
both indicate they extend AbstractIndex
as their nearest public super type, with no indication they are actually both IndexConfiguration
s.
Alternatively, the Database.createIndex()
API could take an AbstractIndex
parameter instead, combining the two overloaded createIndex()
methods which take either an Index
or IndexConfiguration
. This may or may not be preferable for this API.
I’d expect IndexConfiguration
to behave similar to Index
, which is the unifying super type of ValueIndex
and FullTextIndex
, which differentiates them from the *IndexConfiguration
types that are also AbstractIndex
subclasses. Index
is a public class with no public constructors, properties, or methods.
Also of note, this isn’t an issue with wrapping the Objective-C API, as CBLIndexConfiguration
is a public type.