View Javadoc

1   /*
2    Copyright (C) 2007 Grid Systems, S.A.
3   
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8   
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
17  */
18  package com.gridsystems.nextgrid.api.pom;
19  
20  import java.net.URI;
21  import java.util.Map;
22  
23  import javax.xml.namespace.QName;
24  
25  import nextgrid.api.pom.Grounding;
26  
27  /**
28   * AbstractGroundingImpl type.
29   *
30   * @author Rodrigo Ruiz
31   */
32  public abstract class AbstractGroundingImpl implements Grounding {
33  
34    /**
35     * Grounding type URI.
36     */
37    private final URI type;
38  
39    /**
40     * Attribute description map.
41     */
42    private final Map<QName, String> attrs;
43  
44    /**
45     * Creates a new instance.
46     *
47     * @param type  Grounding type URI
48     * @param attrs Attribute description map
49     */
50    public AbstractGroundingImpl(URI type, Map<QName, String> attrs) {
51      this.type = type;
52      this.attrs = attrs;
53    }
54  
55    /**
56     * {@inheritDoc}
57     */
58    public final Map<QName, String> getSupportedAttribs() {
59      return this.attrs;
60    }
61  
62  
63    /**
64     * {@inheritDoc}
65     */
66    public final URI getType() {
67      return this.type;
68    }
69  
70  
71    /**
72     * Creates a grounding attribute QName, using NS_GROUNDING as the namespace.
73     *
74     * @param localName The attribute local name
75     * @return The attribute QName
76     */
77    protected static QName attr(String localName) {
78      return new QName(NS_GROUNDING, localName);
79    }
80  }