Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 18 Functions : Example Custom Function with Tooltips

Example Custom Function with Tooltips
The following very simple example of a custom function illustrates the required structure of a function called add, with the Java annotation that displays the tooltip for the function (beginning at @FunctionJavadoc in the example below).

 
package com.acme.functions.string;
   
import com.tibco.be.model.functions.FunctionJavaDoc;
import com.tibco.be.model.functions.FunctionParamDescriptor;
public class StringFunctions {
 
   public @FunctionJavaDoc (
      name="add",
      synopsis="Returns the concatenation of two strings.",
      signature="String add (String a, String b)",
      params={
         @FunctionParamDescriptor(
                     name="a",
                     type="String",
                     desc="param 1"),
         @FunctionParamDescriptor(
                     name="b",
                     type="String",
                     desc="param 2")},
      freturn = @FunctionParamDescriptor
               name="",
               type="String",
               desc="The concatenation of the parameter string"),
 
      version="5.1.0",
      see="",
      mapper=false,
      cautions="none",
      domain={"action","condition","query"},
      example="<br/> " +
            "String result = concatenate(\"a\",\"b\");" +
            "<br/><br/> Result is: result contains: \"ab\"."
   )
   static String add(String a, String b) {
      return a+b; // default impl.
   }

 
The sample above should provide enough guidance. A few additional notes follow.
synopsis  Add the description of the function in the synopsis parameter.
domain  Shows where the function can be used. This text is informational only. It does not appear in the tooltip. The code controlling where the function can be used (and the decorations that appear) is in the function catalog. See <isActionOnly>, <isValidInQuery>, <isValidInBUI> in Table 27, Function Catalog Elements.
version  Specify the version of TIBCO BusinessEvents that this function supports. Informational only.
see  Provide a URL for additional information.
mapper  Set to true if the function uses the XSLT Mapper feature. The Mapper decoration is added if the function catalog has a <mapper> element. In the function catalog file is more detailed code to support use of functions in the XSLT Mapper.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved