我们可以为内部类生成弗雷格代码。输入到 native-gen 工具的类名是Class.getName
. 对于Animation.Status
枚举,它是javafx.animation.Animation$Status
.
$ java -jar native-gen-1.0-SNAPSHOT.jar
Enter class name: javafx.animation.Animation$Status
data Animation_Status = pure native javafx.animation.Animation.Status where
pure native paused "javafx.animation.Animation.Status.PAUSED" :: Animation_Status
pure native running "javafx.animation.Animation.Status.RUNNING" :: Animation_Status
pure native stopped "javafx.animation.Animation.Status.STOPPED" :: Animation_Status
pure native valueOf "javafx.animation.Animation.Status.valueOf" :: String -> Animation_Status
native values "javafx.animation.Animation.Status.values" :: () -> STMutable s (JArray Animation_Status)
derive Serializable Animation_Status
顺便说一句,native-gen
我目前正在开发的版本可以递归地为整个 Java 包及其子包生成 Frege 代码。我们可以只给出根包javafx
,它会为其所有子包中的所有类创建 Frege 模块。我希望在本周末之前发布这个。