EnumFieldType

class EnumFieldType<V : Enum<V>>(enumValues: Array<V>, fieldValue: EnumValue<V, *>, type: FieldType<*, *>, termType: KClass<*>) : SimpleFieldType<V>

A field type that transforms enum variants to field values and vice verse.

Parameters

V

the type of enum

enumValues

an array of enum variants. Usually got by calling enumValues function.

fieldValue

function interface that takes enum variant and returns field value.

type

original field type

termType

should be V::class

Constructors

EnumFieldType
Link copied to clipboard
fun <V : Enum<V>> EnumFieldType(enumValues: Array<V>, fieldValue: EnumValue<V, *>, type: FieldType<*, *>, termType: KClass<*>)
the type of enum

Functions

deserialize
Link copied to clipboard
open override fun deserialize(v: Any, valueFactory: () -> V?): V
Deserializes field value from Elasticsearch.
deserializeTerm
Link copied to clipboard
open override fun deserializeTerm(v: Any): V
Deserializes term value from Elasticsearch.
serialize
Link copied to clipboard
open override fun serialize(v: V): Any
Serializes field value to Elasticsearch.
serializeTerm
Link copied to clipboard
open override fun serializeTerm(v: V): Any
Serializes term value to Elasticsearch.

Properties

name
Link copied to clipboard
open override val name: String
Name of Elasticsearch mapping type.
termType
Link copied to clipboard
open override val termType: KClass<*>
should be V::class