Class NameFile

java.lang.Object
jmri.jmrit.XmlFile
jmri.jmrit.symbolicprog.NameFile

public class NameFile extends XmlFile
Represents a set of standard names and aliases in memory.

This class doesn't provide tools for defining the names and aliases; that's done manually, or at least not done here, to create the file.

This automatically initializes from the default file if requested from the InstanceManager.

  • Field Details

  • Constructor Details

  • Method Details

    • names

      public Set<String> names()
    • elementFromName

      public org.jdom2.Element elementFromName(String name)
    • checkName

      public boolean checkName(String name)
      Check to see if a name is present in the file.
      Parameters:
      name - the name to check
      Returns:
      true if present; false otherwise
    • readFile

      void readFile(String name) throws org.jdom2.JDOMException, IOException
      Read the contents of a NameFile XML file into this object. Note that this does not clear any existing entries.
      Parameters:
      name - File name to read
      Throws:
      org.jdom2.JDOMException - if the file can't be parsed
      IOException - from underlying IO operations
    • readNames

      void readNames(org.jdom2.Element root)
    • storeDefinition

      void storeDefinition(org.jdom2.Element el)
    • defaultNameFilename

      protected static String defaultNameFilename()
      Get the filename for the default file, including location. This is here to allow easy override in tests.
      Returns:
      the default filename