Class CatalogByString

java.lang.Object
eu.bandm.tools.muli.Catalog<String>
eu.bandm.tools.muli.CatalogByString
Direct Known Subclasses:
BatchOptions.Descriptions, CallXsltOptions.Descriptions, DocTexts, InsertOverprintOptions.Descriptions, JarLinkerOptions.Descriptions, JWhichOptions.Descriptions, Messages, Options.Descriptions, Options.Descriptions, Options.Descriptions, Options.Descriptions, Options.Descriptions, Options.Descriptions, Options.Descriptions, ParameterExpanderOptions.Descriptions, ToolOptions.Descriptions, Translations, Translations, Translations, Translations

public class CatalogByString extends Catalog<String>
An instantiation of Catalog with String as type parameter for the keys. This allows easy denotation and construction, and is the standard case for multi-lingual text interfaces. Additionally, this class defines methods for de-serialization, i.e. reading such a catalog from a simple file format.
  • Field Details

  • Constructor Details

    • CatalogByString

      public CatalogByString()
  • Method Details

    • getKeys

      public SortedSet<String> getKeys()
      Overrides:
      getKeys in class Catalog<String>
      Returns:
      all key objects in an unmodifiable copy. (FIXME could be sorted if comparable =)
    • putAsKey

      public void putAsKey(String... pairs)
      Put translations in which the very first text is also the key. Calls Catalog.put(Object, List)
    • normalizeLinefeed

      public static String normalizeLinefeed(String s)
    • load

      public void load(File f, boolean eliminateNewlines, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg)
      Fill the data encoded in the text file into the catalog object. The text structure is described directly by a simple dtd. See also the user documentation
      Parameters:
      f - the source file
      msg - receives error messages when parsing
    • load

      public void load(Reader s, String sourceId, boolean eliminateNewlines, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg)
      Fill the data encoded in the current text of the reader into the catalog object. The text structure is described directly by a simple dtd. See also the user documentation
      Parameters:
      s - represents the source stream
      sourceId - substitutes the file name for generating error messages
      msg - receives error messages when parsing
    • doload

      public void doload(InputSource s, boolean eliminateNewlines)
    • main

      public static void main(String[] args)
      test function: takes arg[0] as the path to a file which is read into a CatalogByString object and dumped to System.out