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