View Javadoc

1   package com.bm.ejb3metadata.annotations.impl;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   
7   /**
8    * List of interceptor classes.
9    * @author Daniel Wiese
10   */
11  public class JInterceptors {
12  
13      /**
14       * List of classes.
15       */
16      private List<String> classes = null;
17  
18      /**
19       * Constructor.
20       */
21      public JInterceptors() {
22          classes = new ArrayList<String>();
23      }
24  
25      /**
26       * Add a class.
27       * @param cls name of the class (asm)
28       */
29      public void addClass(final String cls) {
30          classes.add(cls);
31      }
32  
33      /**
34       * @return list of classes.
35       */
36      public List<String> getClasses() {
37          return classes;
38      }
39  
40      /**
41       * @param cls the name of an encoded class.
42       * @return true if the class is already in the list.
43       */
44      public boolean contains(final String cls) {
45          return classes.contains(cls);
46      }
47  
48      /**
49       * @return string representation
50       */
51      @Override
52      public String toString() {
53          StringBuilder sb = new StringBuilder();
54          // classname
55          sb.append(this.getClass().getName().substring(this.getClass().getPackage().getName().length() + 1));
56  
57          // list
58          sb.append(classes);
59          return sb.toString();
60      }
61  
62  }