Class URIPrefixes


  • public class URIPrefixes
    extends Object
    Represents the prefixes for modules and extensions in XLIFF URI fragment identifiers. This object is set to load automatically a default mapping and possibly a custom one the first time resolve(String) is called.
    • Constructor Detail

      • URIPrefixes

        public URIPrefixes()
        Creates a simple URIPrefixes object.
      • URIPrefixes

        public URIPrefixes​(File extraPrefixes)
        Creates a URIPrefixes object with a given file where custom prefixes are stored.
        Parameters:
        extraPrefixes - the properties file where the custom prefixes are stored (can be null)
    • Method Detail

      • loadDefaults

        public void loadDefaults()
        Loads the default prefixes from the default properties file. This method is called automatically if needed in resolve(String).
      • add

        public void add​(Map<String,​String> map)
        Adds a collection of uri/prefix to this object. Calls doAutoLoads() if no mapping is loaded yet.
        Parameters:
        map - the map to add.
      • addExtra

        public void addExtra​(File inputFile)
        Adds prefixes from a given properties file. If no mapping is loaded yet, the default one is loaded automatically before loading the one defined in this given properties file.
        Parameters:
        inputFile - the properties file where to get the extra prefixes from.
      • resolve

        public List<String> resolve​(String prefix)
        Resolves a given prefix. Calls doAutoLoads() if no mapping is loaded yet.
        Parameters:
        prefix - the prefix to look-up.
        Returns:
        the array of namespace URIs associated with the given prefix, or null if the prefix is not found.
      • get

        public Map<String,​List<String>> get()
        Gets the current mapping of prefixes. Calls doAutoLoads() if no mapping is loaded yet.
        Returns:
        the current mapping.
      • doAutoLoads

        public void doAutoLoads()
        Performs the auto-loading steps: load the defaults, then adds the custom prefixes if a file for them is set.