Use "new style" type hints

This commit is contained in:
Michael S. Klishin 2011-10-08 03:48:46 +04:00
parent d05b5bec8c
commit 74dcd77092

View file

@ -23,20 +23,20 @@
(defn ^WriteResult insert (defn ^WriteResult insert
([^String collection, ^DBObject document] ([^String collection, ^DBObject document]
(let [#^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)] (let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
(.insert #^DBCollection coll #^DBObject (to-db-object document) #^WriteConcern monger.core/*mongodb-write-concern*))) (.insert ^DBCollection coll ^DBObject (to-db-object document) ^WriteConcern monger.core/*mongodb-write-concern*)))
([^String collection, ^DBObject document, ^WriteConcern concern] ([^String collection, ^DBObject document, ^WriteConcern concern]
(let [#^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)] (let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
(.insert #^DBCollection coll #^DBObject (to-db-object document) #^WriteConcern concern)))) (.insert ^DBCollection coll ^DBObject (to-db-object document) ^WriteConcern concern))))
(defn ^WriteResult insert-batch (defn ^WriteResult insert-batch
([^String collection, ^List documents] ([^String collection, ^List documents]
(let [#^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)] (let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
(.insert #^DBCollection coll #^List (to-db-object documents) #^WriteConcern WriteConcern/NORMAL))) (.insert ^DBCollection coll ^List (to-db-object documents) ^WriteConcern WriteConcern/NORMAL)))
([^String collection, ^List documents, ^WriteConcern concern] ([^String collection, ^List documents, ^WriteConcern concern]
(let [#^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)] (let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
(.insert #^DBCollection coll #^List (to-db-object documents) #^WriteConcern concern)))) (.insert ^DBCollection coll ^List (to-db-object documents) ^WriteConcern concern))))
;; ;;
;; monger.collection/find ;; monger.collection/find
@ -45,15 +45,15 @@
(defn ^DBCursor find (defn ^DBCursor find
([^String collection] ([^String collection]
(let [#^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)] (let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
(.find coll))) (.find coll)))
([^String collection, ^Map ref] ([^String collection, ^Map ref]
(let [#^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)] (let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
(.find #^DBCollection coll #^DBObject (to-db-object ref)))) (.find ^DBCollection coll ^DBObject (to-db-object ref))))
([^String collection, ^Map ref, ^List fields] ([^String collection, ^Map ref, ^List fields]
(let [#^DBCollection coll (.getCollection monger.core/*mongodb-database* collection) (let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)
map-of-fields (fields-to-db-object fields)] map-of-fields (fields-to-db-object fields)]
(.find #^DBCollection coll #^DBObject (to-db-object ref) #^DBObject (to-db-object map-of-fields))))) (.find ^DBCollection coll ^DBObject (to-db-object ref) ^DBObject (to-db-object map-of-fields)))))
(defn ^ISeq find-maps (defn ^ISeq find-maps
([^String collection] ([^String collection]
@ -69,12 +69,12 @@
(defn ^DBObject find-one (defn ^DBObject find-one
([^String collection, ^Map ref] ([^String collection, ^Map ref]
(let [#^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)] (let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
(.findOne #^DBCollection coll #^DBObject (to-db-object ref)))) (.findOne ^DBCollection coll ^DBObject (to-db-object ref))))
([^String collection, ^Map ref, ^List fields] ([^String collection, ^Map ref, ^List fields]
(let [#^DBCollection coll (.getCollection monger.core/*mongodb-database* collection) (let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)
map-of-fields (fields-to-db-object fields)] map-of-fields (fields-to-db-object fields)]
(.findOne #^DBCollection coll #^DBObject (to-db-object ref) #^DBObject (to-db-object map-of-fields))))) (.findOne ^DBCollection coll ^DBObject (to-db-object ref) ^DBObject (to-db-object map-of-fields)))))
(defn ^IPersistentMap find-one-as-map (defn ^IPersistentMap find-one-as-map
([^String collection, ^Map ref] ([^String collection, ^Map ref]