Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
// do parsing
Map<IKeywordParameter, String> result = parameterHelper.parse(parameterString);
 
// getting values from result
String value = result.get(ParallelizationKeywordParameter.DEGREE_OF_PARALLELIZATION);
Info
titleInfo

By default the structure of the parameter string is validated through and regular expression. In this case the value of the parameter need to contain only a-z0-9 and underscores. If the value has a more complex structure it is possible to define a custom regular expression. In this case the instantiation of the parser is shown in the following code example.

Code Block
private static final String PATTERN_PAIRS = "((([a-zA-Z0-9_]+)|([(][a-zA-Z0-9_]+([:][a-zA-Z0-9_]+)+[)]))[,])"
			+ "*(([a-zA-Z0-9_]+)|([(][a-zA-Z0-9_]+([:][a-zA-Z0-9_]+)+[)]))";
private static final String PATTERN_WITH_ATTRIBUTESNAMES = "([(][a-zA-Z0-9_]+[=]"
			+ PATTERN_PAIRS
			+ "[)])([\\s][(][a-zA-Z0-9_]+[=]"
			+ PATTERN_PAIRS
			+ "[)])*";
private static final String PATTERN_WITHOUT_ATTRIBUTENAMES = "("
			+ PATTERN_PAIRS + ")([\\s]" + PATTERN_PAIRS + ")*";
private static final String PATTERN_KEYWORD = PATTERN_WITH_ATTRIBUTESNAMES
			+ "|" + PATTERN_WITHOUT_ATTRIBUTENAMES;
 
...
 
parameterHelper = PreParserKeywordParameterHelper.newInstance(InterOperatorParallelizationKeywordParameter.class, PATTERN_KEYWORD);