I am creating a simple plug-in to generate Fibonacci series. In my java code I h

I am creating a simple plug-in to generate Fibonacci series. In my java code I have used ArrayList<Integer> a = new ArrayList<Integer>() to store all the numbers in an Array. At the end of the code, I return the ArrayList object i.e return a. But when I call my function in Expression Rule after exporting the plugin to the plugin folder, the function doesn't seem to exist. Is this because I am returning an Array of values? What should I do to generate an array of values?

I had made another simple plug-in to fetch the factorial of a number. This worked successfully.



  Discussion posts and replies are publicly visible

  • my function appear in the expression rule. My java code for fibonacci series plugin is:

    import java.util.ArrayList;

    import org.apache.log4j.Logger;

    import com.appiancorp.services.ServiceContext;
    import com.appiancorp.suiteapi.expression.annotations.Function;
    import com.appiancorp.suiteapi.expression.annotations.Parameter;
    import com.appiancorp.suiteapi.type.AppianType;

    public class fibonacci {

              private static final Logger LOG = Logger.getLogger(fibonacci.class);

              public Integer[] fibonacci(ServiceContext sc, @Parameter(type=AppianType.INTEGER) int fibo) {
                        ArrayList<Integer> a = new ArrayList<Integer>();
                        int a0=0, a1=1;
                        int a2=0;
                        for(int i=2;i<fibo;i++)
                        return (Integer[]) a.toArray();


    I get the error:

    Expression evaluation error : Unresolved compilation problem: Type mismatch: cannot convert from Object[] to Integer[]
  • 0
    Certified Senior Developer
    in reply to zianf

    hi @zianf can you please learn me how to create plugin s in java code

  • 0
    Certified Lead Developer
    in reply to sidagamr0001

    I am not sure why you reply to a 6 years old post, but find the documentation here:


Reply Children
No Data