KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > deployment > annotations > impl > JInterface


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: JInterface.java 503 2006-05-24 13:44:31Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.easybeans.deployment.annotations.impl;
27
28 import java.util.ArrayList JavaDoc;
29 import java.util.List JavaDoc;
30
31 /**
32  * List of interfaces.
33  * @author Florent Benoit
34  */

35 public abstract class JInterface {
36
37     /**
38      * List of interfaces.
39      */

40     private List JavaDoc<String JavaDoc> interfaces = null;
41
42     /**
43      * Constructor.
44      */

45     public JInterface() {
46         interfaces = new ArrayList JavaDoc<String JavaDoc>();
47     }
48
49     /**
50      * Add an interface.
51      * @param itf name of the interface (asm)
52      */

53     public void addInterface(final String JavaDoc itf) {
54         interfaces.add(itf);
55     }
56
57     /**
58      * @return list of interfaces.
59      */

60     public List JavaDoc<String JavaDoc> getInterfaces() {
61         return interfaces;
62     }
63
64     /**
65      * @param itf the name of an encoded interface.
66      * @return true if the interface is already in the list.
67      */

68     public boolean contains(final String JavaDoc itf) {
69         return interfaces.contains(itf);
70     }
71
72     /**
73      * @return string representation
74      */

75     @Override JavaDoc
76     public String JavaDoc toString() {
77         StringBuilder JavaDoc sb = new StringBuilder JavaDoc();
78         // classname
79
sb.append(this.getClass().getName().substring(this.getClass().getPackage().getName().length() + 1));
80
81         // list
82
sb.append(interfaces);
83         return sb.toString();
84     }
85 }
86
Popular Tags