jdk/src/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java
author smarks
Thu, 08 Dec 2011 14:57:13 -0800
changeset 11276 6a7de6dddc18
parent 5506 202f599c92aa
child 14342 8435a30053c1
permissions -rw-r--r--
7118546: fix warnings in javax.xml.crypto, javax.script Reviewed-by: mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * $Id: DOMCryptoContext.java,v 1.3 2005/05/09 18:33:26 mullan Exp $
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
package javax.xml.crypto.dom;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.xml.crypto.KeySelector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.xml.crypto.URIDereferencer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.xml.crypto.XMLCryptoContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.Collections;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.HashMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.util.Iterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import org.w3c.dom.Element;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * This class provides a DOM-specific implementation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * {@link XMLCryptoContext} interface. It also includes additional
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * methods that are specific to a DOM-based implementation for registering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * and retrieving elements that contain attributes of type ID.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * @author Sean Mullan
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @author JSR 105 Expert Group
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
public class DOMCryptoContext implements XMLCryptoContext {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    50
    private HashMap<String,String> nsMap = new HashMap<>();
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    51
    private HashMap<String,Element> idMap = new HashMap<>();
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    52
    private HashMap<Object,Object> objMap = new HashMap<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    private String baseURI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private KeySelector ks;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    private URIDereferencer dereferencer;
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    56
    private HashMap<String,Object> propMap = new HashMap<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private String defaultPrefix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * Default constructor. (For invocation by subclass constructors).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    protected DOMCryptoContext() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * This implementation uses an internal {@link HashMap} to get the prefix
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * that the specified URI maps to. It returns the <code>defaultPrefix</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * if it maps to <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public String getNamespacePrefix(String namespaceURI,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        String defaultPrefix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        if (namespaceURI == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
            throw new NullPointerException("namespaceURI cannot be null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        }
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    76
        String prefix = nsMap.get(namespaceURI);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        return (prefix != null ? prefix : defaultPrefix);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * This implementation uses an internal {@link HashMap} to map the URI
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * to the specified prefix.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    public String putNamespacePrefix(String namespaceURI, String prefix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        if (namespaceURI == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            throw new NullPointerException("namespaceURI is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        }
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    90
        return nsMap.put(namespaceURI, prefix);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    public String getDefaultNamespacePrefix() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        return defaultPrefix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    public void setDefaultNamespacePrefix(String defaultPrefix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        this.defaultPrefix = defaultPrefix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    public String getBaseURI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        return baseURI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * @throws IllegalArgumentException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    public void setBaseURI(String baseURI) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        if (baseURI != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            java.net.URI.create(baseURI);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        this.baseURI = baseURI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    public URIDereferencer getURIDereferencer() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        return dereferencer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    public void setURIDereferencer(URIDereferencer dereferencer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        this.dereferencer = dereferencer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * This implementation uses an internal {@link HashMap} to get the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * that the specified name maps to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    public Object getProperty(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        if (name == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            throw new NullPointerException("name is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        return propMap.get(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * This implementation uses an internal {@link HashMap} to map the name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * to the specified object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    public Object setProperty(String name, Object value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        if (name == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            throw new NullPointerException("name is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        return propMap.put(name, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    public KeySelector getKeySelector() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        return ks;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    public void setKeySelector(KeySelector ks) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        this.ks = ks;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * Returns the <code>Element</code> with the specified ID attribute value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * <p>This implementation uses an internal {@link HashMap} to get the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * element that the specified attribute value maps to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * @param idValue the value of the ID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @return the <code>Element</code> with the specified ID attribute value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *    or <code>null</code> if none.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @throws NullPointerException if <code>idValue</code> is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @see #setIdAttributeNS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    public Element getElementById(String idValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        if (idValue == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            throw new NullPointerException("idValue is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        }
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
   173
        return idMap.get(idValue);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * Registers the element's attribute specified by the namespace URI and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * local name to be of type ID. The attribute must have a non-empty value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * <p>This implementation uses an internal {@link HashMap} to map the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * attribute's value to the specified element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * @param element the element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * @param namespaceURI the namespace URI of the attribute (specify
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     *    <code>null</code> if not applicable)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @param localName the local name of the attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * @throws IllegalArgumentException if <code>localName</code> is not an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *    attribute of the specified element or it does not contain a specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *    value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * @throws NullPointerException if <code>element</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *    <code>localName</code> is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @see #getElementById
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    public void setIdAttributeNS(Element element, String namespaceURI,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        String localName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        if (element == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            throw new NullPointerException("element is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        if (localName == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            throw new NullPointerException("localName is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        String idValue = element.getAttributeNS(namespaceURI, localName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        if (idValue == null || idValue.length() == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            throw new IllegalArgumentException(localName + " is not an " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                "attribute");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        idMap.put(idValue, element);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * Returns a read-only iterator over the set of Id/Element mappings of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * this <code>DOMCryptoContext</code>. Attempts to modify the set via the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * {@link Iterator#remove} method throw an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * <code>UnsupportedOperationException</code>. The mappings are returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * in no particular order. Each element in the iteration is represented as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * {@link java.util.Map.Entry}. If the <code>DOMCryptoContext</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * modified while an iteration is in progress, the results of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * iteration are undefined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @return a read-only iterator over the set of mappings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     */
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
   222
    @SuppressWarnings("rawtypes")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    public Iterator iterator() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        return Collections.unmodifiableMap(idMap).entrySet().iterator();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * This implementation uses an internal {@link HashMap} to get the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * that the specified key maps to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    public Object get(Object key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        return objMap.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * This implementation uses an internal {@link HashMap} to map the key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * to the specified object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * @throws IllegalArgumentException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    public Object put(Object key, Object value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        return objMap.put(key, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
}