Package jmri.managers

Class AbstractStringIOManager

    • Method Detail

      • getXMLOrder

        public int getXMLOrder()
        Determine the order that types should be written when storing panel files. Uses one of the constants defined in this class.

        Yes, that's an overly-centralized methodology, but it works for now.

        Specified by:
        getXMLOrder in interface Manager<StringIO>
        Returns:
        write order for this Manager; larger is later.
      • getStringIO

        public StringIO getStringIO​(@Nonnull
                                    java.lang.String name)
        Description copied from interface: StringIOManager
        Get an existing StringIO or return null if it doesn't exist. Locates via user name, then system name if needed.
        Specified by:
        getStringIO in interface StringIOManager
        Parameters:
        name - User name or system name to match
        Returns:
        null if no match found
      • newStringIO

        @Nonnull
        public final StringIO newStringIO​(@Nonnull
                                          java.lang.String systemName,
                                          java.lang.String userName)
                                   throws java.lang.IllegalArgumentException
        Create a New StringIO. Return a StringIO with the specified user or system name. Return StringIO by UserName else provide by SystemName.

        Note that two calls with the same arguments will get the same instance; there is only one StringIO object with a specific system or user name.

        This will always return a valid object reference; a new object will be created if necessary. If that's not possible, an IllegalArgumentException is thrown.

        If a new object has to be created:

        • If a null reference is given for user name, no user name will be associated with the Sensor object created; a valid system name must be provided
        • If both names are provided, the system name defines the hardware access of the desired sensor, and the user address is associated with it. The system name must be valid.
        Note that it is possible to make an inconsistent request if both addresses are provided, but the given values are associated with different objects. This is a problem, and we don't have a good solution except to issue warnings. This will mostly happen if you're creating StringIOs when you should be looking them up.
        Specified by:
        newStringIO in interface StringIOManager
        Parameters:
        systemName - the desired system name
        userName - the desired user name
        Returns:
        requested StringIO object
        Throws:
        java.lang.IllegalArgumentException - if cannot create the StringIO due to e.g. an illegal name or name that can't be parsed.
      • getBeanTypeHandled

        @Nonnull
        public java.lang.String getBeanTypeHandled​(boolean plural)
        Get bean type handled.
        Specified by:
        getBeanTypeHandled in interface Manager<StringIO>
        Parameters:
        plural - true to return plural form of the type; false to return singular form
        Returns:
        a string for the type of object handled by this manager
      • getNamedBeanClass

        public java.lang.Class<StringIOgetNamedBeanClass()
        Get the class of NamedBean supported by this Manager. This should be the generic class used in the Manager's class declaration.
        Specified by:
        getNamedBeanClass in interface Manager<StringIO>
        Returns:
        the class supported by this Manager.
      • createNewStringIO

        @Nonnull
        protected abstract StringIO createNewStringIO​(@Nonnull
                                                      java.lang.String systemName,
                                                      java.lang.String userName)
                                               throws java.lang.IllegalArgumentException
        Internal method to invoke the factory and create a new StringIO. Called after all the logic for returning an existing StringIO has been invoked. An existing SystemName is not found, existing UserName not found. Implementing classes should base StringIO on the system name, then add user name.
        Parameters:
        systemName - the system name to use for the new StringIO
        userName - the optional user name to use for the new StringIO
        Returns:
        the new StringIO
        Throws:
        java.lang.IllegalArgumentException - if unsuccessful with reason for fail.
      • getEntryToolTip

        public java.lang.String getEntryToolTip()
        Get a manager-specific tool tip for adding an entry to the manager.
        Specified by:
        getEntryToolTip in interface Manager<StringIO>
        Returns:
        the tool tip or null to disable the tool tip