MCPcopy Create free account
hub / github.com/JavaCourse00/JavaCourseCodes / main

Method main

02nio/nio01/src/main/java/Main.java:12–32  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

10public class Main {
11
12 public static void main(String[] args) {
13 Map<String, Class> map = new HashMap<>();
14 map.put("1", HttpServer01.class);
15 map.put("2", HttpServer02.class);
16 map.put("3", HttpServer03.class);
17 map.put("8", NettyHttpServer.class);
18
19 String id = (null == args || args.length == 0) ? "1" : args[0];
20 Class clazz = map.get(id);
21 if( null == clazz ) {
22 System.out.println("No class for id: " + id);
23 }
24
25 try {
26 Method method = clazz.getDeclaredMethod("main", new Class[]{String[].class});
27 method.invoke(null, new Object[]{new String[]{}});
28 } catch (Exception e) {
29 e.printStackTrace();
30 }
31
32 }
33
34}

Callers

nothing calls this directly

Calls 4

printlnMethod · 0.80
getMethod · 0.65
putMethod · 0.45
invokeMethod · 0.45

Tested by

no test coverage detected