Prepararory changes for Reflection.

This commit is contained in:
Daniel Ziltener 2017-01-11 18:02:45 +00:00
parent 867e8d5a63
commit d971a87391

View file

@ -1,10 +1,12 @@
(ns clojurefx.factory (ns clojurefx.factory
(:require [taoensso.timbre :as timbre] (:require [taoensso.timbre :as timbre]
[clojure.java.io :as io] [clojure.java.io :as io]
[clojure.reflect :as reflect]
[clojurefx.clojurefx :as fx] [clojurefx.clojurefx :as fx]
[clojurefx.protocols :refer :all]) [clojurefx.protocols :refer :all])
(:import (javafx.scene Scene Node Parent) (:import (javafx.scene Scene Node Parent)
(javafx.scene.layout Region))) (javafx.scene.layout Region)
(clojure.reflect Constructor)))
(timbre/refer-timbre) (timbre/refer-timbre)
@ -60,8 +62,17 @@
})) }))
(def constructor-args (def constructor-args
(atom {javafx.scene.Scene [:root] (atom {javafx.scene.Scene [(with-meta :root {:type javafx.scene.Parent})]
javafx.stage.Stage [:style]})) javafx.stage.Stage [(with-meta :style {:type javafx.stage.StageStyle})]}))
(defn find-constructor [clazz cargs]
(->> (reflect/reflect clazz)
(filter #(= Constructor (class %)))
(map :parameter-types)
(filter #(= cargs %))
first))
(declare compile-o-matic) (declare compile-o-matic)
(defn apply-props-to-node [node props] (defn apply-props-to-node [node props]