 	tgt-model-name (or (pmap :model) (.toString (gensym "OutputModel")))
 	src-metadata (. src-model getMetadata)
 	src-class (. src-metadata getValueClass)
+	src-names (. src-metadata getAttributeNames)
 	src-types (. src-metadata getAttributeTypes)
-	src-names (. src-metadata getAttributeNames)
-	src-map (apply array-map (interleave src-names src-types)) ; name:type
-	fields (make-fields src-class src-map props) ; selection ([type name ...])
+	src-type-map (apply array-map (interleave src-names src-types)) ; name:type
+	src-getters (. src-metadata getAttributeGetters)
+	src-getter-map (apply array-map (interleave src-names src-getters)) ; name:getter
+	fields (make-fields src-class src-type-map src-getter-map props) ; selection ([type name ...])
    	tgt-types (map (fn [field] (nth field 0)) fields)
+	;; test to see if transform is needed should be done somewhere here...
    	tgt-names (map (fn [field] (nth field 1)) fields)
-	src-getters (. src-metadata getAttributeGetters)
    	sel-getters (map (fn [field] (nth field 2)) fields)
-	;; we should be able to take src-getters directly from metadata
-	;; map them to name and then
-	;;sel-getters (map (fn [name] (src-getter-map name)) tgt-names)
 	tgt-props (map (fn [field] [(nth field 0) (nth field 1)]) fields) ; ([type name]..)
 	class-factory (new ClassFactory)
   	tgt-class (apply make-class class-factory tgt-class-name tgt-props)

	  [name (make-proxy-getter tgt-class type name)]))
    fields)))

(defn make-fields [src-class src-map props]
  (map (fn [prop]
	   (let [src-name (first prop)
		 src-type (src-map src-name)]
	     (apply expand-property src-class src-type prop)))
       props))

(defn select [src-model key-name version-name props & pvec]

;; [name & options :name string :type class :convert fn :default val/fn] - TODO: :key, :version
;; TODO :default not a good idea - would replace nulls
;; TODO what about type hints on lambdas ?
(defn expand-property [src-class src-type src-getter src-name & pvec]
  (let [pmap (apply array-map pvec)
	tgt-type (or (pmap :type) src-type)
	tgt-name (or (pmap :name) src-name)
	convert (or (pmap :convert) identity)
	default (or (pmap :default) ())
	defaulter (if (fn? default) default (fn [value] default))
	retriever (fn [value] (convert (. src-getter get value)))]
    [tgt-type tgt-name retriever]
    ))

