Set parameter as required

gabriel_nemeth
gabriel_nemeth New Altair Community Member
edited November 5 in Community Q&A

Hi,

 

currently I have 2 parameters (URL_TEXT, LEVEL_TEXT):

 

public static final String URL_TEXT = "URL";
public static final String LEVEL_TEXT = "Depth of a crawl";

@Override
public List<ParameterType> getParameterTypes(){
List<ParameterType> types = super.getParameterTypes();

types.add(new ParameterTypeString(URL_TEXT, "", "", false));

types.add(new ParameterTypeString(LEVEL_TEXT, "", "", false));

return types;
}

How can I set these 2 parameters as required?

 

Best Answer

  • gabriel_nemeth
    gabriel_nemeth New Altair Community Member
    Answer ✓

    I found another implementation in core:

     

    public ParameterTypeString(String key, String description, boolean optional) {
    super(key, description);
    this.defaultValue = null;
    setOptional(optional);
    }

    So in my case:

    types.add(new ParameterTypeString(URL_TEXT, "Desc", false));

Answers

  • gabriel_nemeth
    gabriel_nemeth New Altair Community Member
    Answer ✓

    I found another implementation in core:

     

    public ParameterTypeString(String key, String description, boolean optional) {
    super(key, description);
    this.defaultValue = null;
    setOptional(optional);
    }

    So in my case:

    types.add(new ParameterTypeString(URL_TEXT, "Desc", false));