How to set Parameter on a Filter Example Operator

imanol_bidegainimanol_bidegain Member Posts: 1 Contributor I
edited November 2018 in Help

I'm trying to change the filter parameters of a Filter Example operator , I'm not sure how have to be written

Operator op = process.getOperator("Filter Examples (8)");
op.setParameter("ExampleFilter.PARAMETER_PARAMETER_STRING",??); // Here is where i don't know what to write.

I hope someone could help me, i'll be very greatful


  • LostSummerLostSummer Member Posts: 2 Contributor I

    Hello there,


    Here is how Operator.setParameter(String key, String value) works.


    The first argument is the key, or the name of the parameter. The type is String, and usually, we refere these keys in the way





    In this way, you may code quicker, avoid type mistake, and keep your program stable.


    The second argument is also a String, for the value of this parameter. This means even for numerics or booleans, you should cast them in to String.

    e.g. "true", "0".


    Here is an example that may help you know how to set and retrieve parameters:


     // here we set the parameter using the method setParameter(String key, String value);
    // ""+int is just a quick way to convert single int into a string

    // now lets test whether the value is set
    String s = opt.getParameterAsString(AttributeSubsetSelector.PARAMETER_FILTER_TYPE);

    // actually you can also get the parameter as an integer or other applicable data type
    int i = opt.getParameterAsInt(AttributeSubsetSelector.PARAMETER_FILTER_TYPE);


Sign In or Register to comment.