Skip to content

Commit

Permalink
chore: Align API to use Collection instead of List
Browse files Browse the repository at this point in the history
  • Loading branch information
Chrylo committed Nov 21, 2023
1 parent 0fbb0fc commit eacfebc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class DataBrokerConnection internal constructor(
@JvmOverloads
fun <T : VssSpecification> subscribe(
specification: T,
fields: List<Field> = listOf(Field.FIELD_VALUE),
fields: Collection<Field> = listOf(Field.FIELD_VALUE),
listener: VssSpecificationListener<T>,
) {
fields.forEach { field ->
Expand All @@ -125,7 +125,7 @@ class DataBrokerConnection internal constructor(
*/
fun <T : VssSpecification> unsubscribe(
specification: T,
fields: List<Field> = listOf(Field.FIELD_VALUE),
fields: Collection<Field> = listOf(Field.FIELD_VALUE),
listener: VssSpecificationListener<T>,
) {
fields.forEach { field ->
Expand Down Expand Up @@ -207,10 +207,11 @@ class DataBrokerConnection internal constructor(
* @throws DataBrokerException in case the connection to the DataBroker is no longer active
* @throws IllegalArgumentException if the [VssProperty] could not be converted to a [Datapoint].
*/
@JvmOverloads
suspend fun update(
vssSpecification: VssSpecification,
fields: List<Field> = listOf(Field.FIELD_VALUE),
): List<SetResponse> {
fields: Collection<Field> = listOf(Field.FIELD_VALUE),
): Collection<SetResponse> {
val responses = mutableListOf<SetResponse>()

vssSpecification.vssProperties.forEach { vssProperty ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface PropertyListener : Listener {
/**
* Will be triggered when an error happens during subscription and forwards the [throwable].
*/
fun onError(throwable: Throwable) {}
fun onError(throwable: Throwable)
}

/**
Expand All @@ -53,5 +53,5 @@ interface VssSpecificationListener<T : VssSpecification> {
/**
* Will be triggered when an error happens during subscription and forwards the [throwable].
*/
fun onError(throwable: Throwable) {}
fun onError(throwable: Throwable)
}

0 comments on commit eacfebc

Please sign in to comment.