1<!doctype html> 2 3#macro(print,$type) 4 #set($string = "$type") 5 #if($string.startsWith("class java.lang.") || $string.startsWith("class java.math.")) 6 #set($string = $string.substring(16)) 7 #end 8$string## 9#end 10 11#macro(cell,$type)<span class="$type">$type</span>#end 12 13#macro(check,$row,$col) 14 #if($introspect.isStrictlyConvertible($row, $col)) #cell('strict') 15 #elseif($introspect.isImplicitlyConvertible($row, $col)) #cell('implicit') 16 #elseif($introspect.isExplicitlyConvertible($row, $col)) #cell('explicit') 17 #else #cell('none') 18 #end 19#end 20 21<html> 22 <head> 23 <style type="text/css"> 24 table 25 { 26 border: solid 1px black; 27 border-collapse: collapse; 28 } 29 td, th 30 { 31 border: solid 1px black; 32 } 33 .strict 34 { 35 color: green; 36 } 37 .implicit 38 { 39 color: blue; 40 } 41 .explicit 42 { 43 color: magenta; 44 } 45 .none 46 { 47 color: red; 48 } 49 50 </style> 51 </head> 52 <body> 53 <table> 54 <thead> 55 <tr> 56 <th> 57 provided →<br/> 58 expected ↓ 59 </th> 60#foreach($col in $types) 61 <th>#print($col)</th> 62#end 63 <th>null</th> 64 </tr> 65#foreach($row in $types) 66 <tr> 67 <th>#print($row)</th> 68 #foreach($col in $types) 69 <td>#check($row,$col)</td> 70 #end 71 #if($row.isPrimitive()) 72 <td>#cell('none')</td> 73 #else 74 <td>#check($row, $null)</td> 75 #end 76 </tr> 77#end 78 </thead> 79 <tbody> 80 </tbody> 81 </table> 82 </body> 83</html> 84 85 86