skip to main content
Corticon Extensions Guide : Code conventions : Using annotations

Try Corticon Now

Using annotations

Corticon extensions use Java annotations to get information about extensions. Corticon supports four types of annotations:
*Class annotations:
*@TopLevelFolder - The name of the top level folder that will contain the extended operator. The operator tree supports two levels of folders; a top level folder and an operator folder. All operators defined in the class will be under a subfolder of the top level folder defined for the class..
*Method annotations
*@Description - The text that describes the operator in the Rule operator tooltip or the description of the service callout in the Ruleflow properties. Note that this is typically the only annotation type used withh service callouts.
*@OperatorFolder - The name of the subfolder, under top level folder, for the operator defined by the method.
*Parameter annotations
*@ArgumentName - The name of the argument shown in the function signature part of the tool tip.
Localizing Annotations
Annotations offer a format that allows localization. In its basic format, you can just enter @Annotation("text").
You can choose to add a list of one or more locales with corresponding strings for each locale. For example:
@Annotation(lang={"en","fr"}, values={"text","texte"})
Creating multi-line annnotations
Some annotations provide the help that the user sees when they hover over an operator in the Rule Operator tab. Often the description can be improved by adding line returns
You can embed line returns in your description by using the "\n text" + convention, as shown:
@Description(lang = { "en" }, values = { "
"\n Replace all occurrences of a substring" +
"\n within a string" +
"\n with another string."
The following excerpt from highlights usage of Corticon extension annotations:
@TopLevelFolder("Sample Extended Operators")
public class AttributeOperators implements ICcDecimalExtension,
ICcStringExtension, ICcDateTimeExtension {

@OperatorFolder(lang = { "en" }, values = { "String" })

@Description(lang = { "en" }, values = { "Replace all occurences of a substring with a string with another string." })
public static String replaceAll(String s,
@ArgumentName(lang = { "en" }, values = { "searchString" }) String searchString,
@ArgumentName(lang = { "en" }, values = { "replacement" }) String replacement) {