Annotation Type NCIntent


  • @Documented
    @Retention(RUNTIME)
    @Target({METHOD,TYPE})
    @Repeatable(NCIntentList.class)
    public @interface NCIntent
    Annotation to bind an intent with the method serving as its callback. This annotation takes a string value that defines an intent via IDL. This annotation can also be applied to a model's class in which case it will just declare the intent without binding it and the callback method will need to use NCIntentRef annotation to actually bind it to the declared intent. Note that multiple intents can be bound to the same callback method, but only one callback method can be bound with a given intent.

    Here's an example of using this annotation (from LightSwitch example):

     @NCIntent("import('intents.idl')")
     @NCIntent("intent=act term(act)={has(tok_groups(), 'act')} term(loc)={trim(tok_id()) == 'ls:loc'}*")
     @NCIntentSample(Array(
         "Turn the lights off in the entire house.",
         "Switch on the illumination in the master bedroom closet.",
         "Get the lights on.",
         "Please, put the light out in the upstairs bedroom."
     ))
     def onMatch(
         @NCIntentTerm("act") actTok: NCToken,
         @NCIntentTerm("loc") locToks: List[NCToken]
     ): NCResult = {
         ...
     }
     

    Read full documentation in Intent Matching section and review examples.

    See Also:
    NCIntentRef, NCIntentTerm, NCIntentSample, NCIntentSampleRef, NCIntentSkip, NCIntentMatch, NCModel.onMatchedIntent(NCIntentMatch)
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String value
      Intent specification using IDL.
    • Element Detail

      • value

        String value
        Intent specification using IDL.
        Returns:
        Intent specification using IDL.
        Default:
        ""