Package jmri

Class Category

  • All Implemented Interfaces:
    java.lang.Comparable<Category>
    Direct Known Subclasses:
    Category.Other, LogixNG_Category

    public abstract class Category
    extends java.lang.Object
    implements java.lang.Comparable<Category>
    A category of something.

    Category was created for LogixNG actions and expressions but it can be used for everything in JMRI that needs "extendable enums".

    This class is intended to be an Enum, but implemented as an abstract class to allow adding more categories later without needing to change this class. For example, external programs using JMRI as a lib might want to add their own categories.

    • Constructor Detail

      • Category

        protected Category​(java.lang.String name,
                           java.lang.String description,
                           int order)
    • Method Detail

      • values

        public static java.util.List<Categoryvalues()
        Get all the registered Categories
        Returns:
        a list of categories
      • registerCategory

        public static Category registerCategory​(Category category)
                                         throws java.lang.IllegalArgumentException
        Register a category. There must not exist any category with either the name or the description of this category. Otherwise an IllegalArgumentException will be thrown.
        Parameters:
        category - the category
        Returns:
        the new category
        Throws:
        java.lang.IllegalArgumentException - if the category already is registered.
      • name

        public final java.lang.String name()
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • order

        public final int order()
      • equals

        public final boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public final int compareTo​(Category c)
        Specified by:
        compareTo in interface java.lang.Comparable<Category>