Class EdtCommandWrapper

java.lang.Object
com.e1c.g5.v8.dt.internal.cli.api.EdtCommandWrapper
All Implemented Interfaces:
ICliCommand, org.apache.felix.service.command.Function

public class EdtCommandWrapper extends Object implements org.apache.felix.service.command.Function, ICliCommand
Decorator for a particular command of a command provider. Exposes itself as a Apache Felix GoGo command via Function interface, redirects control to the wrapped command via reflection. Allows to implement special features which would be impossible if ICliCommand were registered as a service directly: 1. kebab-case suport; 2. Argument annotation support; 3. argument types fine tuning (e.g. better support of array types).
  • Constructor Details

    • EdtCommandWrapper

      public EdtCommandWrapper(com.e1c.g5.v8.dt.internal.cli.api.CommandRegistry registry, ICliCommand commandProvider, String commandName, String namespace)
      Creates a new command wrapper.
      Parameters:
      registry - command registry this command is a part of, cannot be null.
      commandProvider - target command provider, cannot be null.
      commandName - the name under which the command is registered (typically in kebab-case). Cannot be null.
      namespace - namespace under which the script is registered. May be null or blank, in which case the default namespace is assumed.
  • Method Details

    • execute

      public Object execute(org.apache.felix.service.command.CommandSession session, List<Object> arguments) throws Exception
      Specified by:
      execute in interface org.apache.felix.service.command.Function
      Throws:
      Exception
    • getCommandProvider

      public ICliCommand getCommandProvider()
      Returns the wrapped command provider.
      Returns:
      the wrapped command provider.
    • getCommandName

      public String getCommandName()
      Returns the command name this command is registered under.
      Returns:
      the command name this command is registered under.
    • getNamespace

      public String getNamespace()
      Returns the namespace this command is registered under.
      Returns:
      the namespace this command is registered under.