Considerations when Defining the Functions

Java methods defining the functions can have primitive data types, or Concept, Event and Object. They can return any primitive data types or Concept, Event and Object.

If the custom functions have primitive data types only, it will also be visible and uable in the mapper. In that case, the category attributes of the @BEPackage annotation is used as the folder for your custom functions.

Note: The interface has some limitations as it does not allow static methods. Do not use annotations when using interfaces. Create an interface as a normal java interface without any annotations and implement it in a class without any annotations. To see these interface methods under the custom catalog function, create a static overloading method with annotations.
For example:
public interface InterfaceProjectLibTest 
{

	    public abstract String[] getAllDestinations();
	
		   public abstract String getClusterName();
}

public class interfImpl implements InterfaceProjectLibTest
{
	    static int count=0;
	    @Override
	    public String[] getAllDestinations() 
	    {
		        Object[] ars= null;
		        RuleSession rs = RuleSessionManager.getCurrentRuleSession();		
		        String[] activdest=(String[])rs.invokeCatalog("Channel.getAllDestinations", ars);
		        count = activdest.length;
		        return activdest;
	    }

	    @Override
	    public String getClusterName() {
		       // TODO Auto-generated method stub
		       Object[] ars= null;
		       RuleSession rs = RuleSessionManager.getCurrentRuleSession();
		       String clustername;
		       clustername=(rs.invokeCatalog("Cluster.getClusterName", ars)).toString();
		       return clustername;
	    }
	
	    @BEFunction(name = "getNoOfDests", signature= "getNoOfDests", description="Returns Number of destinations of the current rulesession")
	    //@BEFunction
	    public static int getNoOfDests()
	    {
		       interfImpl im = new interfImpl();
		       im.getAllDestinations();
		   +    System.out.println("count: " + count);
		       return count;
	    }
	
	    @BEFunction(name = "ReturnAllDestinations", signature= "getAllDest", description="Returns all destinations of the current rulesession")	
	    public static String[] getAllDest()
	    {
		       interfImpl im = new interfImpl();
		       String[] activedests = im.getAllDestinations();
		
		       return activedests;
		
	    }

	    @BEFunction(name = "ReturnClusterName", signature= "getClusName()", description="Returns the clustername")
    	public static String getClusName()
	    {
		       interfImpl im = new interfImpl();
		       String clustername=im.getClusterName();
		       System.out.println("ClusterName is: " + clustername);
		       return clustername;
	    }
}