 ;; & :class xxx :model yyy
 
   (def view
-       (select
-	input-model
-	"key"
-	"version"
-	(list ["id" :name "key"] ["version"] ["amount" :name "money"])))
+       (select input-model "key" "version"
+	       '(["id" :name "key"] ["version"] ["amount" :name "money"])))
   (insert metamodel view)
 
   (def item5 (make-instance input-class 3 2 2 6.0))

    #(Update. % nil)
    (.getData model))))

(import '(clojure.lang DynamicClassLoader))

;; e.g.
;;(make-class
;; factory
;; "org.dada.tmp.Amount"
;; ["int" "id"] ["int" "version"] ["double" "amount"])
(defn make-class2 [factory name & properties]
  (. #^DynamicClassLoader
     (deref clojure.lang.Compiler/LOADER)
     (defineClass name 
       (.create 
	factory
	name
	(into-array (map #(into-array String %) properties))))))

(defn make-class [factory name & properties]
  (. #^DynamicClassLoader
     (deref clojure.lang.Compiler/LOADER)
     (defineClass name 
       (.create 
	factory
	name
	(into-array (map (fn [pair] 
			     (let [array (make-array String 2)]
			       (aset array 0 (.getCanonicalName (first pair)))
			       (aset array 1 (first (rest pair)))
			       array))
			 properties))))))

;; fields => [model field]

(import org.dada.core.Getter)
(import org.dada.core.Transformer)
(import org.dada.core.Transformer$Transform)
(import org.dada.core.GetterMetadata)
(import org.dada.core.VersionedModelView)
(import org.dada.asm.ClassFactory)
(import java.beans.PropertyDescriptor)

(defn make-constructor [class & types]
  (let [ctor (symbol (str (.getCanonicalName class) "."))]

	     (apply expand-property src-type src-getter prop)))
       props))

;; TODO
;; allow selection from a number of src-models
;; allow selection into a number of src views
;; allow filtering :filter <filter-fn>
;; allow splitting :split <split-fn> implemented by router - should provide fn for tgt-view construction...
;; abstract out tgt-view construction so it can be done from parameters, during select, or on-demand from router...

(defn select [src-model key-name version-name props & pvec]
  (let [pmap (apply array-map pvec)
	src-metadata (. src-model getMetadata)
	src-class (. src-metadata getValueClass)
	src-names (. src-metadata getAttributeNames)
