1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.jetty.webapp;
20
21 import org.eclipse.jetty.util.Loader;
22 import org.eclipse.jetty.util.log.Log;
23 import org.eclipse.jetty.util.log.Logger;
24
25
26
27
28
29
30
31
32 public abstract class DiscoveredAnnotation
33 {
34 private static final Logger LOG = Log.getLogger(DiscoveredAnnotation.class);
35
36 protected WebAppContext _context;
37 protected String _className;
38 protected Class<?> _clazz;
39
40 public abstract void apply();
41
42 public DiscoveredAnnotation (WebAppContext context, String className)
43 {
44 _context = context;
45 _className = className;
46 }
47
48
49 public Class<?> getTargetClass()
50 {
51 if (_clazz != null)
52 return _clazz;
53
54 loadClass();
55
56 return _clazz;
57 }
58
59 private void loadClass ()
60 {
61 if (_clazz != null)
62 return;
63
64 if (_className == null)
65 return;
66
67 try
68 {
69 _clazz = Loader.loadClass(null, _className);
70 }
71 catch (Exception e)
72 {
73 LOG.warn(e);
74 }
75 }
76 }