@@ -34,36 +34,39 @@ final class CachedMostSpecificTypeFirstSelection(converters: Traversable[Convert
34
34
35
35
def addToCache (sm : Type [_], tm : Type [_], hint : AnyRef , cv : Converter ) = {
36
36
lock(_lock) {
37
+ // logger.debug("addToCache(%s, %s, %s, %s)".format(sm, tm, hint, cv))
37
38
_cache += ((sm, tm, hint) -> Just (cv))
38
39
}
39
40
}
40
41
41
42
override def findCached [S , T ](sm : Type [S ], tm : Type [T ], hint : AnyRef ) = {
42
43
_cache.get((sm, tm, hint)) match {
43
44
case Some (jcv) =>
44
- logger.debug(" findCached(%s, %s) => %s" .format(sm, tm, jcv))
45
+ // logger.debug("findCached(%s, %s, %s ) => %s".format(sm, tm, hint , jcv))
45
46
jcv.asInstanceOf [Maybe [Converter ]]
46
47
case None =>
47
- logger.debug(" findCached(%s, %s) => %s" .format(sm, tm, None ))
48
+ // logger.debug("findCached(%s, %s, %s ) => %s".format(sm, tm, hint , None))
48
49
NoVal
49
50
}
50
51
}
51
52
52
53
def findNonCached [S , T ](sm : Type [S ], tm : Type [T ], hint : AnyRef ): Maybe [Converter ] = {
53
- _strictSourceConverters.find(_.get.canConvertType(sm, tm, hint )) match {
54
+ _strictSourceConverters.find(_.get.canConvertType(hint)( sm, tm)) match {
54
55
case Some (jcv) =>
55
- logger.debug(" findNonCached(%s, %s, %s) => STRICT: %s" .format(sm, tm, hint, jcv))
56
+ // logger.debug("findNonCached(%s, %s, %s) => STRICT: %s".format(sm, tm, hint, jcv))
56
57
jcv.asInstanceOf [Maybe [Converter ]]
57
58
case None =>
58
- _nonStrictSourceConverters foreach { case convJ =>
59
- val conv = convJ.get
60
- }
61
- _nonStrictSourceConverters.find(_.get.canConvertType(sm, tm, hint)) match {
59
+ _nonStrictSourceConverters.find { converterJust ⇒
60
+ val converter = converterJust.get
61
+ val canConvert = converter.canConvertType(hint)(sm, tm)
62
+ // logger.debug("%s: canConvertType(%s, %s, %s) by %s".format(canConvert, sm, tm, hint, converter))
63
+ canConvert
64
+ } match {
62
65
case Some (jcv) =>
63
- logger.debug(" findNonCached(%s, %s, %s) => NON-STRICT: %s" .format(sm, tm, hint, jcv))
66
+ // logger.debug("findNonCached(%s, %s, %s) => NON-STRICT: %s".format(sm, tm, hint, jcv))
64
67
jcv.asInstanceOf [Maybe [Converter ]]
65
68
case None =>
66
- logger.debug(" findNonCached(%s, %s, %s) => %s" .format(sm, tm, hint, None ))
69
+ // logger.debug("findNonCached(%s, %s, %s) => %s".format(sm, tm, hint, None))
67
70
NoVal
68
71
}
69
72
}
0 commit comments