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 */ 019package org.apache.wiki.htmltowiki; 020 021import java.util.Collection; 022import java.util.Map; 023import java.util.Properties; 024import java.util.Set; 025 026/** 027 * Adds the load / save - functionality known from the Properties - class to any 028 * Map implementation. 029 * 030 */ 031public class PersistentMapDecorator extends Properties 032{ 033 private static final long serialVersionUID = 0L; 034 035 private Map< Object, Object > m_delegate; 036 037 /** 038 * Creates a new decorator for a given map. 039 * 040 * @param delegate The map to create a decorator for. 041 */ 042 public PersistentMapDecorator( Map< Object, Object > delegate ) 043 { 044 m_delegate = delegate; 045 } 046 047 /** 048 * {@inheritDoc} 049 */ 050 @Override 051 public void clear() 052 { 053 m_delegate.clear(); 054 } 055 056 /** 057 * {@inheritDoc} 058 */ 059 @Override 060 public boolean containsKey( Object key ) 061 { 062 return m_delegate.containsKey( key ); 063 } 064 065 /** 066 * {@inheritDoc} 067 */ 068 @Override 069 public boolean containsValue( Object value ) 070 { 071 return m_delegate.containsValue( value ); 072 } 073 074 /** 075 * {@inheritDoc} 076 */ 077 @Override 078 public Set< Map.Entry< Object, Object > > entrySet() 079 { 080 return m_delegate.entrySet(); 081 } 082 083 /** 084 * {@inheritDoc} 085 */ 086 @Override 087 public boolean equals( Object obj ) 088 { 089 return m_delegate.equals( obj ); 090 } 091 092 /** 093 * {@inheritDoc} 094 */ 095 @Override 096 public Object get( Object key ) 097 { 098 return m_delegate.get( key ); 099 } 100 101 /** 102 * {@inheritDoc} 103 */ 104 @Override 105 public int hashCode() 106 { 107 return m_delegate.hashCode(); 108 } 109 110 /** 111 * {@inheritDoc} 112 */ 113 @Override 114 public boolean isEmpty() 115 { 116 return m_delegate.isEmpty(); 117 } 118 119 /** 120 * {@inheritDoc} 121 */ 122 @Override 123 public Set< Object > keySet() 124 { 125 return m_delegate.keySet(); 126 } 127 128 /** 129 * {@inheritDoc} 130 */ 131 @Override 132 public Object put( Object arg0, Object arg1 ) 133 { 134 return m_delegate.put( arg0, arg1 ); 135 } 136 137 /** 138 * {@inheritDoc} 139 */ 140 @Override 141 public void putAll( Map< ?, ? > arg0 ) 142 { 143 m_delegate.putAll( arg0 ); 144 } 145 146 /** 147 * {@inheritDoc} 148 */ 149 @Override 150 public Object remove( Object key ) 151 { 152 return m_delegate.remove( key ); 153 } 154 155 /** 156 * {@inheritDoc} 157 */ 158 @Override 159 public int size() 160 { 161 return m_delegate.size(); 162 } 163 164 /** 165 * {@inheritDoc} 166 */ 167 @Override 168 public String toString() 169 { 170 return m_delegate.toString(); 171 } 172 173 /** 174 * {@inheritDoc} 175 */ 176 @Override 177 public Collection< Object > values() 178 { 179 return m_delegate.values(); 180 } 181}