indy.nl updates
[mir.git] / source / mir / util / DateToMapAdapter.java
1 package mir.util;
2
3 import java.util.*;
4 import java.text.*;
5
6 public class DateToMapAdapter extends AbstractMap {
7   Date date;
8
9   public DateToMapAdapter(Date aDate) {
10     date = aDate;
11   }
12
13   public Object get(Object aKey) {
14     if (aKey instanceof String) {
15       try {
16         return new SimpleDateFormat((String) aKey).format(date);
17       }
18       catch (Throwable t) {
19         throw new RuntimeException( "Can't format date with format " + (String) aKey + ": " + t.getMessage());
20       }
21     }
22     else return null;
23   }
24
25   public Set entrySet() {
26     return new HashSet();
27   }
28 }