Class CommandRef


  • public class CommandRef
    extends java.lang.Object
    Description of a command (a TextBuiltin subclass).

    These descriptions are lightweight compared to creating a command instance and are therefore suitable for catalogs of "known" commands without linking the command's implementation and creating a dummy instance of the command.

    • Field Detail

      • impl

        private final java.lang.Class<? extends TextBuiltin> impl
      • name

        private final java.lang.String name
      • usage

        private java.lang.String usage
      • common

        boolean common
    • Constructor Detail

      • CommandRef

        CommandRef​(java.lang.Class<? extends TextBuiltin> clazz)
      • CommandRef

        private CommandRef​(java.lang.Class<? extends TextBuiltin> clazz,
                           java.lang.String cn)
    • Method Detail

      • guessName

        private static java.lang.String guessName​(java.lang.Class<? extends TextBuiltin> clazz)
      • getName

        public java.lang.String getName()
        Get the name.
        Returns:
        name the command is invoked as from the command line.
      • getUsage

        public java.lang.String getUsage()
        Get usage.
        Returns:
        one line description of the command's feature set.
      • isCommon

        public boolean isCommon()
        Is this command commonly used
        Returns:
        true if this command is considered to be commonly used.
      • getImplementationClassName

        public java.lang.String getImplementationClassName()
        Get implementation class name
        Returns:
        name of the Java class which implements this command.
      • getImplementationClassLoader

        public java.lang.ClassLoader getImplementationClassLoader()
        Get implementation class loader
        Returns:
        loader for getImplementationClassName().
      • create

        public TextBuiltin create()
        Create an instance of the command implementation
        Returns:
        a new instance of the command implementation.
      • toString

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