package com.annimon.hotarufx.visual;

import com.annimon.hotarufx.lib.NumberValue;
import com.annimon.hotarufx.lib.StringValue;
import com.annimon.hotarufx.lib.Types;
import com.annimon.hotarufx.lib.Value;
import java.util.function.Function;
import javafx.scene.paint.Color;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
@Getter
public enum PropertyType {

    NUMBER(toNumber(), o -> NumberValue.of((Number) o)),
    PAINT(v -> Color.valueOf(v.asString()), o -> new StringValue(o.toString()));

    private final Function<Value, Object> fromHFX;
    private final Function<Object, Value> toHFX;

    private static Function<Value, Object> toNumber() {
        return value -> {
            if (value.type() == Types.NUMBER) {
                return ((NumberValue) value).raw();
            }
            return value.asNumber();
        };
    }
}

@@ -299,30 +299,8 @@
 el;%0A
-import lombok.Getter;%0A
 impo
@@ -334,16 +334,16 @@
 ructor;%0A
+
 %0A@Requir
@@ -394,16 +394,8 @@
 GE)%0A
-@Getter%0A
 publ
@@ -608,16 +608,16 @@
 romHFX;%0A
-
     priv
@@ -658,16 +658,285 @@
 toHFX;%0A%0A
+    @SuppressWarnings(%22unchecked%22)%0A    public %3CT%3E Function%3CValue, T%3E getFromHFX() %7B%0A        return (Function%3CValue, T%3E) fromHFX;%0A    %7D%0A%0A    @SuppressWarnings(%22unchecked%22)%0A    public %3CT%3E Function%3CT, Value%3E getToHFX() %7B%0A        return (Function%3CT, Value%3E) toHFX;%0A    %7D%0A%0A%0A
     priv

Add generic type to converters signature