private void decorateMatching(Criteria c) {
if (!isElligibleForMatching(c)) {
return;
}
PropertyEqualCriteria criteria = (PropertyEqualCriteria) c;
String oldValue = criteria.getValue();
String newValue;
switch (criteria.getMatchingStrategy()) {
case starts:
newValue = oldValue + "(.*)";
break;
case contains:
newValue = "(.*)" + oldValue + "(.*)";
break;
case ends:
newValue = "(.*)" + oldValue;
break;
default:
throw new InvalidSelectorException("Can't find strategy");
}
criteria.setValue(newValue);
criteria.setMatchingStrategy(MatchingStrategy.regex);
}