| 1 |
/*- |
| 2 |
* See the file LICENSE for redistribution information. |
| 3 |
* |
| 4 |
* Copyright (c) 2002, 2013 Oracle and/or its affiliates. All rights reserved. |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
package com.sleepycat.persist.impl; |
| 9 |
|
| 10 |
import java.util.Map; |
| 11 |
|
| 12 |
/** |
| 13 |
* Read-only catalog used by a PersistComparator to return simple formats plus |
| 14 |
* reconstituted enum formats. |
| 15 |
* |
| 16 |
* @author Mark Hayes |
| 17 |
*/ |
| 18 |
class ComparatorCatalog extends SimpleCatalog { |
| 19 |
|
| 20 |
private final Map<String, Format> formatMap; |
| 21 |
|
| 22 |
ComparatorCatalog(final ClassLoader classLoader, |
| 23 |
final Map<String, Format> formatMap) { |
| 24 |
super(classLoader); |
| 25 |
this.formatMap = formatMap; |
| 26 |
} |
| 27 |
|
| 28 |
public Format getFormat(final String className) { |
| 29 |
if (formatMap != null) { |
| 30 |
final Format f = formatMap.get(className); |
| 31 |
if (f != null) { |
| 32 |
return f; |
| 33 |
} |
| 34 |
} |
| 35 |
return super.getFormat(className); |
| 36 |
} |
| 37 |
} |