Skip to content

Commit

Permalink
Add space before colon when bounding generic parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
anti-social committed Jan 4, 2024
1 parent 622c7d3 commit ba7b350
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enum class SearchType : ToValue<String> {
* suspendable or blocking.
*/
@Suppress("UnnecessaryAbstractClass")
abstract class BaseSearchQuery<S: BaseDocSource, T: BaseSearchQuery<S, T>>(
abstract class BaseSearchQuery<S : BaseDocSource, T : BaseSearchQuery<S, T>>(
protected val docSourceFactory: (obj: Deserializer.ObjectCtx) -> S,
protected var query: QueryExpression? = null,
params: Params = Params(),
Expand Down Expand Up @@ -147,7 +147,7 @@ abstract class BaseSearchQuery<S: BaseDocSource, T: BaseSearchQuery<S, T>>(
*
* @sample samples.code.SearchQuery.queryNode
*/
inline fun <reified N: QueryExpression> queryNode(
inline fun <reified N : QueryExpression> queryNode(
handle: NodeHandle<N>,
block: (N) -> N
): T {
Expand Down Expand Up @@ -776,7 +776,7 @@ abstract class BaseSearchQuery<S: BaseDocSource, T: BaseSearchQuery<S, T>>(
/**
* An asynchronous version of search query.
*/
open class SearchQuery<S: BaseDocSource>(
open class SearchQuery<S : BaseDocSource>(
docSourceFactory: (obj: Deserializer.ObjectCtx) -> S,
query: QueryExpression? = null,
params: Params = Params(),
Expand Down Expand Up @@ -927,7 +927,7 @@ open class SearchQuery<S: BaseDocSource>(
* A prepared search query is a public read-only view to a search query.
* Mainly it is used to compile a search query.
*/
data class Search<out S: BaseDocSource>(
data class Search<out S : BaseDocSource>(
val docSourceFactory: (obj: Deserializer.ObjectCtx) -> S,
override val query: QueryExpression?,
override val filters: List<QueryExpression>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.evo.elasticmagic

sealed class Version<T: Version<T>> : Comparable<T> {
sealed class Version<T : Version<T>> : Comparable<T> {
companion object {
fun compareVersions(
major: Int, minor: Int, patch: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ sealed class AggValue<T> : ObjExpression {
* Base aggregation expression.
* @param R an aggregation result type for this aggregation
*/
interface Aggregation<R: AggregationResult> : NamedExpression {
interface Aggregation<R : AggregationResult> : NamedExpression {
/**
* Processes corresponding aggregation response.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import dev.evo.elasticmagic.serde.Deserializer
import dev.evo.elasticmagic.serde.Serializer
import dev.evo.elasticmagic.serde.forEachObj

abstract class BucketAggregation<R: AggregationResult> : Aggregation<R> {
abstract class BucketAggregation<R : AggregationResult> : Aggregation<R> {
abstract val aggs: Map<String, Aggregation<*>>

override fun accept(ctx: Serializer.ObjectCtx, compiler: BaseSearchQueryCompiler) {
Expand Down Expand Up @@ -41,7 +41,7 @@ abstract class SingleBucketAggregation : BucketAggregation<SingleBucketAggResult
}
}

abstract class BucketAggResult<B: BaseBucket> : AggregationResult {
abstract class BucketAggResult<B : BaseBucket> : AggregationResult {
abstract val buckets: List<B>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data class HistogramBounds<T>(
}
}

abstract class BaseHistogramAgg<T, R: AggregationResult, B> : BucketAggregation<R>() {
abstract class BaseHistogramAgg<T, R : AggregationResult, B> : BucketAggregation<R>() {
abstract val value: AggValue<T>
abstract val minDocCount: Long?
abstract val missing: T?
Expand Down Expand Up @@ -97,7 +97,7 @@ abstract class BaseHistogramAgg<T, R: AggregationResult, B> : BucketAggregation<
protected abstract val makeHistogramResult: (List<B>) -> R
}

data class HistogramAgg<T: Number>(
data class HistogramAgg<T : Number>(
override val value: AggValue<T>,
val interval: T,
val offset: T? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data class AggRange<T>(
}
}

abstract class BaseRangeAgg<T, R: AggregationResult, B> : BucketAggregation<R>() {
abstract class BaseRangeAgg<T, R : AggregationResult, B> : BucketAggregation<R>() {
abstract val value: AggValue<T>
abstract val ranges: List<AggRange<T>>
abstract val format: String?
Expand Down Expand Up @@ -94,7 +94,7 @@ data class RangeBucket(
override val aggs: Map<String, AggregationResult> = emptyMap(),
) : KeyedBucket<String>()

data class RangeAgg<T: Number>(
data class RangeAgg<T : Number>(
override val value: AggValue<T>,
override val ranges: List<AggRange<T>>,
override val format: String? = null,
Expand All @@ -121,7 +121,7 @@ data class RangeAgg<T: Number>(
)

companion object {
fun <T: Number> simpleRanges(
fun <T : Number> simpleRanges(
field: FieldOperations<T>,
ranges: List<Pair<T?, T?>>,
format: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import dev.evo.elasticmagic.serde.Deserializer
import dev.evo.elasticmagic.serde.Serializer
import dev.evo.elasticmagic.serde.forEachObj

abstract class BaseTermsAgg<T, R: AggregationResult> : BucketAggregation<R>() {
abstract class BaseTermsAgg<T, R : AggregationResult> : BucketAggregation<R>() {
abstract val value: AggValue<T>
abstract val size: Int?
abstract val shardSize: Int?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ interface IdActionMeta : ActionMeta {
*
* @see <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html>
*/
open class IndexAction<S: BaseDocSource>(
open class IndexAction<S : BaseDocSource>(
override val meta: ActionMeta,
override val source: S,
override val concurrencyControl: ConcurrencyControl? = null,
Expand All @@ -136,7 +136,7 @@ open class IndexAction<S: BaseDocSource>(
*
* @see <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html>
*/
class CreateAction<S: BaseDocSource>(
class CreateAction<S : BaseDocSource>(
meta: ActionMeta,
source: S,
pipeline: String? = null,
Expand Down Expand Up @@ -168,7 +168,7 @@ class DeleteAction(
*
* @see <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html>
*/
class UpdateAction<S: BaseDocSource>(
class UpdateAction<S : BaseDocSource>(
override val meta: IdActionMeta,
override val source: UpdateSource<S>,
val retryOnConflict: Int? = null,
Expand All @@ -185,7 +185,7 @@ class UpdateAction<S: BaseDocSource>(
* - [WithDoc] makes a partial update of the existing document.
* - [WithScript] runs the specified script and indexes its result.
*/
sealed class UpdateSource<S: BaseDocSource>(
sealed class UpdateSource<S : BaseDocSource>(
val upsert: S?,
val detectNoop: Boolean?,
) {
Expand All @@ -199,7 +199,7 @@ sealed class UpdateSource<S: BaseDocSource>(
detectNoop = detectNoop,
)

class WithScript<S: BaseDocSource>(
class WithScript<S : BaseDocSource>(
val script: Script,
val scriptedUpsert: Boolean? = null,
upsert: S? = null,
Expand All @@ -213,7 +213,7 @@ sealed class UpdateSource<S: BaseDocSource>(
/**
* Combines a document source with its action metadata.
*/
class DocSourceAndMeta<M: ActionMeta>(
class DocSourceAndMeta<M : ActionMeta>(
val meta: M,
val doc: BaseDocSource
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ enum class ElasticsearchFeatures(
}
}
private fun <T: Version<T>> findFeatures(
private fun <T : Version<T>> findFeatures(
esVersion: T, features: List<Pair<T, ElasticsearchFeatures>>
): ElasticsearchFeatures {
for (versionToFeature in features.reversed()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ open class SearchQueryCompiler(
}
}

fun <S: BaseDocSource> compile(
fun <S : BaseDocSource> compile(
serde: Serde, searchQuery: WithIndex<SearchQuery.Search<S>>
): ApiRequest<SearchQueryResult<S>> {
val body = serde.serializer.obj {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ abstract class FieldSet : FieldSetShortcuts(), Named {
* It is not recommended to use [Enum.ordinal] property for field value as it can change
* when new variant is added.
*/
inline fun <reified V: Enum<V>> FieldSet.Field<Int, Int>.enum(
inline fun <reified V : Enum<V>> FieldSet.Field<Int, Int>.enum(
fieldValue: IntEnumValue<V>,
): FieldSet.Field<V, V> {
return FieldSet.Field(
Expand All @@ -454,7 +454,7 @@ inline fun <reified V: Enum<V>> FieldSet.Field<Int, Int>.enum(
* @param fieldValue function that provides field value of an enum variant.
* [Enum.name] property will be used if [fieldValue] is not provided.
*/
inline fun <reified V: Enum<V>> FieldSet.Field<String, String>.enum(
inline fun <reified V : Enum<V>> FieldSet.Field<String, String>.enum(
fieldValue: KeywordEnumValue<V>? = null,
): FieldSet.Field<V, V> {
return FieldSet.Field(
Expand Down Expand Up @@ -482,7 +482,7 @@ open class SubFields<V>(private val field: BoundField<V, V>) : FieldSet(), Field

override fun getQualifiedFieldName(): String = field.getQualifiedFieldName()

class UnboundSubFields<V, F: SubFields<V>>(
class UnboundSubFields<V, F : SubFields<V>>(
internal val unboundField: Field<V, V>,
internal val subFieldsFactory: (BoundField<V, V>) -> F,
) {
Expand Down Expand Up @@ -520,12 +520,12 @@ internal class SubFieldsField<T>(
) : WrapperField<T>(field)

abstract class BaseDocument : FieldSet() {
fun <V, F: SubFields<V>> Field<V, V>.subFields(
fun <V, F : SubFields<V>> Field<V, V>.subFields(
factory: (BoundField<V, V>) -> F): SubFields.UnboundSubFields<V, F> {
return SubFields.UnboundSubFields(this, factory)
}

fun <T: SubDocument> `object`(
fun <T : SubDocument> `object`(
name: String?,
factory: (DocSourceField) -> T,
enabled: Boolean? = null,
Expand All @@ -541,7 +541,7 @@ abstract class BaseDocument : FieldSet() {
return SubDocument.UnboundSubDocument(name, ObjectType(), params, factory)
}

fun <T: SubDocument> `object`(
fun <T : SubDocument> `object`(
factory: (DocSourceField) -> T,
enabled: Boolean? = null,
dynamic: Dynamic? = null,
Expand All @@ -550,7 +550,7 @@ abstract class BaseDocument : FieldSet() {
return `object`(null, factory, enabled, dynamic, params)
}

fun <T: SubDocument> obj(
fun <T : SubDocument> obj(
name: String?,
factory: (DocSourceField) -> T,
enabled: Boolean? = null,
Expand All @@ -560,7 +560,7 @@ abstract class BaseDocument : FieldSet() {
return `object`(name, factory, enabled, dynamic, params)
}

fun <T: SubDocument> obj(
fun <T : SubDocument> obj(
factory: (DocSourceField) -> T,
enabled: Boolean? = null,
dynamic: Dynamic? = null,
Expand All @@ -569,7 +569,7 @@ abstract class BaseDocument : FieldSet() {
return `object`(factory, enabled, dynamic, params)
}

fun <T: SubDocument> nested(
fun <T : SubDocument> nested(
name: String?,
factory: (DocSourceField) -> T,
dynamic: Dynamic? = null,
Expand All @@ -583,7 +583,7 @@ abstract class BaseDocument : FieldSet() {
return SubDocument.UnboundSubDocument(name, NestedType(), params, factory)
}

fun <T: SubDocument> nested(
fun <T : SubDocument> nested(
factory: (DocSourceField) -> T,
dynamic: Dynamic? = null,
params: Params = Params()
Expand Down Expand Up @@ -616,7 +616,7 @@ abstract class SubDocument(

fun getParent(): FieldSet = field.getParent()

class UnboundSubDocument<T: SubDocument>(
class UnboundSubDocument<T : SubDocument>(
private val name: String?,
internal val type: ObjectType<BaseDocSource>,
internal val params: Params,
Expand Down Expand Up @@ -667,7 +667,7 @@ open class MetaFields : RootFieldSet() {
open val size by SizeField()

@Suppress("UnnecessaryAbstractClass")
abstract class BaseMetaField<V, B: MappingField<V>>(
abstract class BaseMetaField<V, B : MappingField<V>>(
name: String, type: FieldType<V, V>, params: Params = Params(),
private val boundFieldFactory: (String, Params, MetaFields) -> B
) : Field<V, V>(name, type, params) {
Expand Down Expand Up @@ -938,7 +938,7 @@ abstract class DynamicTemplates : RootFieldSet() {
/**
* Template for a field with sub-fields.
*/
fun <V, F: SubFields<V>> template(
fun <V, F : SubFields<V>> template(
name: String? = null,
mapping: SubFields.UnboundSubFields<V, F>,
matchMappingType: MatchMappingType<*, *>? = null,
Expand Down Expand Up @@ -967,7 +967,7 @@ abstract class DynamicTemplates : RootFieldSet() {
/**
* Template for a sub-document field.
*/
fun <F: SubDocument> template(
fun <F : SubDocument> template(
name: String? = null,
mapping: SubDocument.UnboundSubDocument<F>,
matchMappingType: MatchMappingType<*, *>? = null,
Expand Down Expand Up @@ -1202,7 +1202,7 @@ abstract class DynamicTemplates : RootFieldSet() {
}
}

class FromSubFields<V, F: SubFields<V>>(
class FromSubFields<V, F : SubFields<V>>(
val subFields: SubFields.UnboundSubFields<V, F>
) : DynamicField<V, V, F>() {
override fun field(fieldPath: String): F {
Expand All @@ -1212,7 +1212,7 @@ abstract class DynamicTemplates : RootFieldSet() {
}
}

class FromSubDocument<F: SubDocument>(
class FromSubDocument<F : SubDocument>(
val subDocument: SubDocument.UnboundSubDocument<F>
) : DynamicField<Any, Nothing, F>() {
override fun field(fieldPath: String): F {
Expand Down Expand Up @@ -1254,7 +1254,7 @@ abstract class DynamicTemplates : RootFieldSet() {

data class Date<V>(override val fieldType: FieldType<V, V>) : MatchMappingType<V, V>()

data class Object<V: BaseDocSource>(override val fieldType: FieldType<V, V>) : MatchMappingType<V, V>()
data class Object<V : BaseDocSource>(override val fieldType: FieldType<V, V>) : MatchMappingType<V, V>()
}

enum class MatchPattern : ToValue<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface Named : ToValue<String> {
}
}

interface Expression<T: Serializer.Ctx> : BaseSearchQueryCompiler.Visitable<T> {
interface Expression<T : Serializer.Ctx> : BaseSearchQueryCompiler.Visitable<T> {
fun clone(): Expression<T>

fun children(): Iterator<Expression<*>>? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ data class FunctionScore(
}
}

data class FieldValueFactor<T: Number>(
data class FieldValueFactor<T : Number>(
val field: FieldOperations<T>,
val factor: Float? = null,
val missing: T? = null,
Expand Down
Loading

0 comments on commit ba7b350

Please sign in to comment.