-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1391 from veraPDF/static_xmp_containers
Add StaticXmpCoreContainers
- Loading branch information
1 parent
ec1f40c
commit f992b28
Showing
5 changed files
with
169 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
xmp-core/src/main/java/org/verapdf/xmp/containers/StaticXmpCoreContainers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.verapdf.xmp.containers; | ||
|
||
import java.util.*; | ||
|
||
public class StaticXmpCoreContainers { | ||
|
||
/** | ||
* a map from a namespace URI to its registered prefix | ||
*/ | ||
private static final ThreadLocal<Map<String, String>> namespaceToPrefixMap = new ThreadLocal<>(); | ||
|
||
/** | ||
* a map from a prefix to the associated namespace URI | ||
*/ | ||
private static final ThreadLocal<Map<String, String>> prefixToNamespaceMap = new ThreadLocal<>(); | ||
|
||
public static void clearAllContainers() { | ||
namespaceToPrefixMap.set(new HashMap<>()); | ||
prefixToNamespaceMap.set(new HashMap<>()); | ||
} | ||
|
||
public static Map<String, String> getNamespaceToPrefixMap() { | ||
return namespaceToPrefixMap.get(); | ||
} | ||
|
||
public static Map<String, String> getPrefixToNamespaceMap() { | ||
return prefixToNamespaceMap.get(); | ||
} | ||
|
||
public static void setNamespaceToPrefixMap(Map<String, String> namespaceToPrefixMap) { | ||
StaticXmpCoreContainers.namespaceToPrefixMap.set(namespaceToPrefixMap); | ||
} | ||
|
||
public static void setPrefixToNamespaceMap(Map<String, String> prefixToNamespaceMap) { | ||
StaticXmpCoreContainers.prefixToNamespaceMap.set(prefixToNamespaceMap); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.