Package com.tailf.dp

Class Completion

Object
com.tailf.dp.Completion
Direct Known Subclasses:
CompletionDefaultReply, CompletionRangeEnumReply, CompletionReply

public abstract class Completion extends Object
Reply structure container for completion callbacks. This is an abstract class its implementation subclasses are instantiated via one of its static newXXXReply methods. Which one to use depend on the actionpoint and the specific invocation.

An example of the usage of this class is as follows:

Having a YANG model snippet like the following:

  container application {
    leaf file-name {
      type string;
      tailf:cli-completion-actionpoint "file-complete" {
        tailf:cli-completion-id "path";
      }
    }
  }
  
The corresponding completion action is as follows:
  @ActionCallback(callPoint = "file-complete",
                 callType = ActionCBType.COMPLETION)
  public Completion completion(DpActionTrans actx, char cliStyle,
                               String token, char completionChar,
                               ConfObject[] kp, String cmdPath,
                               String cmdParamId, ConfQname simpleType,
                               String extra) throws DpCallbackException {
     ....
     // User processing of the completion
     ....
     CompletionReply reply = Completion.newReply();
     reply.addCompletion("completion-entry1", null);
     ...
     reply.addCompletion("completion-entryN", null);
     reply.setCompletionInfo("my-info");
     reply.setCompletionDesc("my-description");
     return reply;
  }
  
  • Constructor Details

    • Completion

      public Completion()
  • Method Details

    • newRangeEnumReply

      public static CompletionRangeEnumReply newRangeEnumReply(int keySize)
      The CompletionRangeEnumReply instance is the expected response for a tailf:cli-custom-range-enumerator actionpoint. The instantiated reply needs to be assembled using its class helper methods before it can be sent as a response. Its use is in YANG model lists where a range completion is of interest. The number of keys in the list needs to be supplied in this call.
      Parameters:
      keySize - number of keys in the list
      Returns:
      CompletionRangeEnumReply
    • newDefaultReply

      public static CompletionDefaultReply newDefaultReply()
      The CompletionDefaultReply instance is the possible response for a tailf:cli-completion-actionpoint or a tailf:cli-custom-range-actionpoint directive. Its use is to signal that the default completion mechanism should be used instead of any assembling of this invocation. As such, no further processing of this instance is needed, instead this instance can be directly passed as a response to the invocation.
      Returns:
      CompletionDefaultReply
    • newReply

      public static CompletionReply newReply()
      The CompletionReply instance is the possible response for a tailf:cli-completion-actionpoint or a tailf:cli-custom-range-actionpoint directive. The instantiated reply needs to be assembled using its class helper methods before it can be sent as a response.
      Returns:
      CompletionReply