jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java
author mullan
Fri, 21 Nov 2014 15:23:36 -0500
changeset 27747 3a271dc8b758
parent 25859 3317bb8137f4
permissions -rw-r--r--
8046949: Generify the javax.xml.crypto API Reviewed-by: xuelei
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
27747
3a271dc8b758 8046949: Generify the javax.xml.crypto API
mullan
parents: 25859
diff changeset
     2
 * Copyright (c) 2005, 2014, 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;
27747
3a271dc8b758 8046949: Generify the javax.xml.crypto API
mullan
parents: 25859
diff changeset
    36
import java.util.Map;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import org.w3c.dom.Element;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * This class provides a DOM-specific implementation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * {@link XMLCryptoContext} interface. It also includes additional
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * methods that are specific to a DOM-based implementation for registering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * and retrieving elements that contain attributes of type ID.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @author Sean Mullan
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @author JSR 105 Expert Group
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
public class DOMCryptoContext implements XMLCryptoContext {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    51
    private HashMap<String,String> nsMap = new HashMap<>();
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    52
    private HashMap<String,Element> idMap = new HashMap<>();
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    53
    private HashMap<Object,Object> objMap = new HashMap<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private String baseURI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    private KeySelector ks;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    private URIDereferencer dereferencer;
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    57
    private HashMap<String,Object> propMap = new HashMap<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    private String defaultPrefix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * Default constructor. (For invocation by subclass constructors).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    protected DOMCryptoContext() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * This implementation uses an internal {@link HashMap} to get the prefix
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * that the specified URI maps to. It returns the <code>defaultPrefix</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * if it maps to <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public String getNamespacePrefix(String namespaceURI,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        String defaultPrefix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        if (namespaceURI == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            throw new NullPointerException("namespaceURI cannot be null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        }
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    77
        String prefix = nsMap.get(namespaceURI);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        return (prefix != null ? prefix : defaultPrefix);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * This implementation uses an internal {@link HashMap} to map the URI
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * to the specified prefix.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public String putNamespacePrefix(String namespaceURI, String prefix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        if (namespaceURI == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            throw new NullPointerException("namespaceURI is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        }
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
    91
        return nsMap.put(namespaceURI, prefix);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public String getDefaultNamespacePrefix() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        return defaultPrefix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    public void setDefaultNamespacePrefix(String defaultPrefix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        this.defaultPrefix = defaultPrefix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    public String getBaseURI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        return baseURI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @throws IllegalArgumentException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    public void setBaseURI(String baseURI) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        if (baseURI != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            java.net.URI.create(baseURI);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        this.baseURI = baseURI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    public URIDereferencer getURIDereferencer() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        return dereferencer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    public void setURIDereferencer(URIDereferencer dereferencer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        this.dereferencer = dereferencer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * This implementation uses an internal {@link HashMap} to get the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * that the specified name maps to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    public Object getProperty(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        if (name == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            throw new NullPointerException("name is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        return propMap.get(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * This implementation uses an internal {@link HashMap} to map the name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * to the specified object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    public Object setProperty(String name, Object value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        if (name == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            throw new NullPointerException("name is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        return propMap.put(name, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    public KeySelector getKeySelector() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        return ks;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    public void setKeySelector(KeySelector ks) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        this.ks = ks;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * Returns the <code>Element</code> with the specified ID attribute value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * <p>This implementation uses an internal {@link HashMap} to get the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * element that the specified attribute value maps to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @param idValue the value of the ID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @return the <code>Element</code> with the specified ID attribute value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *    or <code>null</code> if none.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @throws NullPointerException if <code>idValue</code> is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @see #setIdAttributeNS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    public Element getElementById(String idValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        if (idValue == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            throw new NullPointerException("idValue is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        }
11276
6a7de6dddc18 7118546: fix warnings in javax.xml.crypto, javax.script
smarks
parents: 5506
diff changeset
   174
        return idMap.get(idValue);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * Registers the element's attribute specified by the namespace URI and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * local name to be of type ID. The attribute must have a non-empty value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * <p>This implementation uses an internal {@link HashMap} to map the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * attribute's value to the specified element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * @param element the element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * @param namespaceURI the namespace URI of the attribute (specify
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     *    <code>null</code> if not applicable)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * @param localName the local name of the attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @throws IllegalArgumentException if <code>localName</code> is not an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *    attribute of the specified element or it does not contain a specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     *    value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * @throws NullPointerException if <code>element</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     *    <code>localName</code> is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @see #getElementById
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    public void setIdAttributeNS(Element element, String namespaceURI,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        String localName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        if (element == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            throw new NullPointerException("element is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        if (localName == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            throw new NullPointerException("localName is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        String idValue = element.getAttributeNS(namespaceURI, localName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        if (idValue == null || idValue.length() == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            throw new IllegalArgumentException(localName + " is not an " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                "attribute");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        idMap.put(idValue, element);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * Returns a read-only iterator over the set of Id/Element mappings of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * this <code>DOMCryptoContext</code>. Attempts to modify the set via the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * {@link Iterator#remove} method throw an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * <code>UnsupportedOperationException</code>. The mappings are returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * in no particular order. Each element in the iteration is represented as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * {@link java.util.Map.Entry}. If the <code>DOMCryptoContext</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * modified while an iteration is in progress, the results of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * iteration are undefined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @return a read-only iterator over the set of mappings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
27747
3a271dc8b758 8046949: Generify the javax.xml.crypto API
mullan
parents: 25859
diff changeset
   223
    public Iterator<Map.Entry<String, Element>> iterator() {
2
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
}