Add back decimal stuff to field synchronizer
This commit is contained in:
parent
1979627817
commit
bb7063c7f8
@ -16,6 +16,7 @@ import ru.dbotthepony.kommons.event.ISubscriptable
|
|||||||
import ru.dbotthepony.kommons.io.BigDecimalValueCodec
|
import ru.dbotthepony.kommons.io.BigDecimalValueCodec
|
||||||
import ru.dbotthepony.kommons.io.BinaryStringCodec
|
import ru.dbotthepony.kommons.io.BinaryStringCodec
|
||||||
import ru.dbotthepony.kommons.io.ByteValueCodec
|
import ru.dbotthepony.kommons.io.ByteValueCodec
|
||||||
|
import ru.dbotthepony.kommons.io.DecimalValueCodec
|
||||||
import ru.dbotthepony.kommons.io.EnumValueCodec
|
import ru.dbotthepony.kommons.io.EnumValueCodec
|
||||||
import ru.dbotthepony.kommons.io.IStreamCodec
|
import ru.dbotthepony.kommons.io.IStreamCodec
|
||||||
import ru.dbotthepony.kommons.io.ShortValueCodec
|
import ru.dbotthepony.kommons.io.ShortValueCodec
|
||||||
@ -28,6 +29,7 @@ import ru.dbotthepony.kommons.io.writeSignedVarInt
|
|||||||
import ru.dbotthepony.kommons.io.writeSignedVarLong
|
import ru.dbotthepony.kommons.io.writeSignedVarLong
|
||||||
import ru.dbotthepony.kommons.io.writeVarInt
|
import ru.dbotthepony.kommons.io.writeVarInt
|
||||||
import ru.dbotthepony.kommons.io.writeVarLong
|
import ru.dbotthepony.kommons.io.writeVarLong
|
||||||
|
import ru.dbotthepony.kommons.math.Decimal
|
||||||
import ru.dbotthepony.kommons.util.BooleanConsumer
|
import ru.dbotthepony.kommons.util.BooleanConsumer
|
||||||
import ru.dbotthepony.kommons.util.FloatConsumer
|
import ru.dbotthepony.kommons.util.FloatConsumer
|
||||||
import ru.dbotthepony.kommons.util.FloatSupplier
|
import ru.dbotthepony.kommons.util.FloatSupplier
|
||||||
@ -108,6 +110,7 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa
|
|||||||
fun computedUuid(getter: () -> UUID) = ComputedField(getter, UUIDValueCodec)
|
fun computedUuid(getter: () -> UUID) = ComputedField(getter, UUIDValueCodec)
|
||||||
fun computedInt(getter: IntSupplier) = ComputedIntField(getter)
|
fun computedInt(getter: IntSupplier) = ComputedIntField(getter)
|
||||||
fun computedFixedInt(getter: IntSupplier) = ComputedFixedIntField(getter)
|
fun computedFixedInt(getter: IntSupplier) = ComputedFixedIntField(getter)
|
||||||
|
fun computedDecimal(getter: () -> Decimal) = ComputedField(getter, DecimalValueCodec)
|
||||||
fun computedBigDecimal(getter: () -> BigDecimal) = ComputedField(getter, BigDecimalValueCodec)
|
fun computedBigDecimal(getter: () -> BigDecimal) = ComputedField(getter, BigDecimalValueCodec)
|
||||||
fun computedString(getter: () -> String) = ComputedField(getter, BinaryStringCodec)
|
fun computedString(getter: () -> String) = ComputedField(getter, BinaryStringCodec)
|
||||||
|
|
||||||
@ -121,6 +124,7 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa
|
|||||||
fun computedUuid(getter: KProperty0<UUID>) = ComputedField(getter, UUIDValueCodec)
|
fun computedUuid(getter: KProperty0<UUID>) = ComputedField(getter, UUIDValueCodec)
|
||||||
fun computedInt(getter: KProperty0<Int>) = ComputedIntField(getter::get)
|
fun computedInt(getter: KProperty0<Int>) = ComputedIntField(getter::get)
|
||||||
fun computedFixedInt(getter: KProperty0<Int>) = ComputedFixedIntField(getter::get)
|
fun computedFixedInt(getter: KProperty0<Int>) = ComputedFixedIntField(getter::get)
|
||||||
|
fun computedDecimal(getter: KProperty0<Decimal>) = ComputedField(getter, DecimalValueCodec)
|
||||||
fun computedBigDecimal(getter: KProperty0<BigDecimal>) = ComputedField(getter, BigDecimalValueCodec)
|
fun computedBigDecimal(getter: KProperty0<BigDecimal>) = ComputedField(getter, BigDecimalValueCodec)
|
||||||
fun computedString(getter: KProperty0<String>) = ComputedField(getter, BinaryStringCodec)
|
fun computedString(getter: KProperty0<String>) = ComputedField(getter, BinaryStringCodec)
|
||||||
|
|
||||||
@ -134,6 +138,7 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa
|
|||||||
fun computedUuid(getter: Supplier<UUID>) = ComputedField(getter::get, UUIDValueCodec)
|
fun computedUuid(getter: Supplier<UUID>) = ComputedField(getter::get, UUIDValueCodec)
|
||||||
fun computedInt(getter: Supplier<Int>) = ComputedIntField(getter::get)
|
fun computedInt(getter: Supplier<Int>) = ComputedIntField(getter::get)
|
||||||
fun computedFixedInt(getter: Supplier<Int>) = ComputedFixedIntField(getter::get)
|
fun computedFixedInt(getter: Supplier<Int>) = ComputedFixedIntField(getter::get)
|
||||||
|
fun computedDecimal(getter: Supplier<Decimal>) = ComputedField(getter::get, DecimalValueCodec)
|
||||||
fun computedBigDecimal(getter: Supplier<BigDecimal>) = ComputedField(getter::get, BigDecimalValueCodec)
|
fun computedBigDecimal(getter: Supplier<BigDecimal>) = ComputedField(getter::get, BigDecimalValueCodec)
|
||||||
fun computedString(getter: Supplier<String>) = ComputedField(getter::get, BinaryStringCodec)
|
fun computedString(getter: Supplier<String>) = ComputedField(getter::get, BinaryStringCodec)
|
||||||
|
|
||||||
@ -245,6 +250,15 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa
|
|||||||
return FixedIntField(value, getter, setter)
|
return FixedIntField(value, getter, setter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
|
fun decimal(
|
||||||
|
value: Decimal = Decimal.ZERO,
|
||||||
|
getter: FieldGetter<Decimal>? = null,
|
||||||
|
setter: FieldSetter<Decimal>? = null,
|
||||||
|
): Field<Decimal> {
|
||||||
|
return Field(value, DecimalValueCodec, getter, setter)
|
||||||
|
}
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun bigDecimal(
|
fun bigDecimal(
|
||||||
value: BigDecimal = BigDecimal.ZERO,
|
value: BigDecimal = BigDecimal.ZERO,
|
||||||
|
Loading…
Reference in New Issue
Block a user