001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019 package org.apache.xbean.osgi.bundle.util;
020
021 import java.util.AbstractMap;
022 import java.util.Dictionary;
023 import java.util.Set;
024
025 /**
026 * Simple wrapper that exposes {@link Dictionary} class as a {@link Map}.
027 *
028 * @version $Rev: 937957 $, $Date: 2010-04-26 16:00:08 +0800 (Mon, 26 Apr 2010) $
029 */
030 public class DictionaryMap extends AbstractMap {
031
032 private final Dictionary dictionary;
033
034 public DictionaryMap(Dictionary dictionary) {
035 this.dictionary = dictionary;
036 }
037
038 @Override
039 public Object get(Object key) {
040 return dictionary.get(key);
041 }
042
043 @Override
044 public Object put(Object key, Object value) {
045 return dictionary.put(key, value);
046 }
047
048 @Override
049 public Object remove(Object key) {
050 return dictionary.remove(key);
051 }
052
053 @Override
054 public int size() {
055 return dictionary.size();
056 }
057
058 @Override
059 public boolean isEmpty() {
060 return dictionary.isEmpty();
061 }
062
063 @Override
064 public Set entrySet() {
065 // TODO: implement
066 throw new UnsupportedOperationException();
067 }
068
069 @Override
070 public Set keySet() {
071 // TODO: implement
072 throw new UnsupportedOperationException();
073 }
074 }