MCPcopy Create free account
hub / github.com/castello/spring_basic / convertTo

Method convertTo

ch2/MethodCall3.java:61–73  ·  view source on GitHub ↗
(Object value, Class type)

Source from the content-addressed store, hash-verified

59 } // main
60
61 private static Object convertTo(Object value, Class type) {
62 if(type==null || value==null || type.isInstance(value)) // 타입이 같으면 그대로 반환
63 return value;
64
65 // 타입이 다르면, 변환해서 반환
66 if(String.class.isInstance(value) && type==int.class) { // String -> int
67 return Integer.valueOf((String)value);
68 } else if(String.class.isInstance(value) && type==double.class) { // String -> double
69 return Double.valueOf((String)value);
70 }
71
72 return value;
73 }
74
75 private static void render(Model model, String viewName) throws IOException {
76 String result = "";

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected