View Javadoc

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