KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > tools > jbicommon > descriptor > Extensions


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005-2006 EBM WebSourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id$
20  * -------------------------------------------------------------------------
21  */

22
23 package org.objectweb.petals.tools.jbicommon.descriptor;
24
25 import java.net.URI JavaDoc;
26 import java.util.HashMap JavaDoc;
27 import java.util.Map JavaDoc;
28
29 import org.apache.commons.lang.builder.EqualsBuilder;
30 import org.apache.commons.lang.builder.HashCodeBuilder;
31 import org.apache.commons.lang.builder.ToStringBuilder;
32 import org.w3c.dom.DocumentFragment JavaDoc;
33
34 /**
35  *
36  * @author ofabre
37  *
38  */

39 public class Extensions {
40
41     private DocumentFragment JavaDoc documentFragment;
42
43     private Map JavaDoc<URI JavaDoc, PetalsExtension> petalsExtensions;
44
45     private Map JavaDoc<URI JavaDoc, UnknownExtension> unknownsExtensions;
46
47     public Extensions() {
48         super();
49         petalsExtensions = new HashMap JavaDoc<URI JavaDoc, PetalsExtension>();
50         unknownsExtensions = new HashMap JavaDoc<URI JavaDoc, UnknownExtension>();
51     }
52
53     public void addPetalsExtension(final URI JavaDoc uri,
54             final PetalsExtension extension) {
55         petalsExtensions.put(uri, extension);
56     }
57
58     public void addUnknownExtension(final URI JavaDoc uri,
59             final UnknownExtension extension) {
60         unknownsExtensions.put(uri, extension);
61     }
62
63     @Override JavaDoc
64     public boolean equals(final Object JavaDoc other) {
65         if (!(other instanceof Extensions)) {
66             return false; // NOPMD by gblondelle
67
}
68         Extensions castOther = (Extensions) other;
69         return new EqualsBuilder().append(petalsExtensions,
70                 castOther.petalsExtensions).append(unknownsExtensions,
71                 castOther.unknownsExtensions).isEquals();
72     }
73
74     public DocumentFragment JavaDoc getDocumentFragment() {
75         return documentFragment;
76     }
77
78     public Map JavaDoc<URI JavaDoc, PetalsExtension> getPetalsExtensions() {
79         return petalsExtensions;
80     }
81
82     public Map JavaDoc<URI JavaDoc, UnknownExtension> getUnknownsExtensions() {
83         return unknownsExtensions;
84     }
85
86     @Override JavaDoc
87     public int hashCode() {
88         return new HashCodeBuilder().append(petalsExtensions).append(
89                 unknownsExtensions).toHashCode();
90     }
91
92     public void setDocumentFragment(final DocumentFragment JavaDoc documentFragment) {
93         this.documentFragment = documentFragment;
94     }
95
96     public void setPetalsExtensions(
97             final Map JavaDoc<URI JavaDoc, PetalsExtension> petalsExtensions) {
98         this.petalsExtensions = petalsExtensions;
99     }
100
101     public void setUnknownsExtensions(
102             final Map JavaDoc<URI JavaDoc, UnknownExtension> unknownsExtensions) {
103         this.unknownsExtensions = unknownsExtensions;
104     }
105
106     @Override JavaDoc
107     public String JavaDoc toString() {
108         return new ToStringBuilder(this).append("petalsExtensions",
109                 petalsExtensions).append("unknownsExtensions",
110                 unknownsExtensions).toString();
111     }
112
113 }
114
Popular Tags