Class 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 Detail

      • _nameHash

        protected java.util.HashMap<java.lang.String,​org.jdom2.Element> _nameHash
    • Method Detail

      • names

        public java.util.Set<java.lang.String> names()
      • elementFromName

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

        public boolean checkName​(java.lang.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​(java.lang.String name)
               throws org.jdom2.JDOMException,
                      java.io.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
        java.io.IOException - from underlying IO operations
      • readNames

        void readNames​(org.jdom2.Element root)
      • defaultNameFilename

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