EnumFieldType

class EnumFieldType<V : Enum<V>>(enumValues: Array<V>, fieldValue: EnumValue<V, *>, type: FieldType<*, *>, val 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

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

Functions

Link copied to clipboard
open override fun deserialize(v: Any, valueFactory: () -> V?): V

Deserializes field value from Elasticsearch.

Link copied to clipboard
open override fun deserializeTerm(v: Any): V

Deserializes term value from Elasticsearch.

Link copied to clipboard
open override fun serialize(v: V): Any

Serializes field value to Elasticsearch.

Link copied to clipboard
open override fun serializeTerm(v: V): Any

Serializes term value to Elasticsearch.

Properties

Link copied to clipboard
open override val name: String

Name of Elasticsearch mapping type.

Link copied to clipboard
open override val termType: KClass<*>