Fixes #911 - Adds support for :contains modifier
Adds support for the :contains modifier in StringClientParam.
This commit is contained in:
parent
c5b286921e
commit
ac8e412e49
|
@ -59,6 +59,13 @@ public class StringClientParam extends BaseClientParam implements IParam {
|
|||
return new StringExactly();
|
||||
}
|
||||
|
||||
/**
|
||||
* The string contains given value
|
||||
*/
|
||||
public IStringMatch contains() {
|
||||
return new StringContains();
|
||||
}
|
||||
|
||||
public interface IStringMatch {
|
||||
|
||||
/**
|
||||
|
@ -109,6 +116,28 @@ public class StringClientParam extends BaseClientParam implements IParam {
|
|||
}
|
||||
}
|
||||
|
||||
private class StringContains implements IStringMatch {
|
||||
@Override
|
||||
public ICriterion<StringClientParam> value(String theValue) {
|
||||
return new StringCriterion<StringClientParam>(getParamName() + Constants.PARAMQUALIFIER_STRING_CONTAINS, theValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICriterion<StringClientParam> value(StringDt theValue) {
|
||||
return new StringCriterion<StringClientParam>(getParamName() + Constants.PARAMQUALIFIER_STRING_CONTAINS, theValue.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICriterion<StringClientParam> values(List<String> theValue) {
|
||||
return new StringCriterion<StringClientParam>(getParamName() + Constants.PARAMQUALIFIER_STRING_CONTAINS, theValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICriterion<?> values(String... theValues) {
|
||||
return new StringCriterion<StringClientParam>(getParamName() + Constants.PARAMQUALIFIER_STRING_CONTAINS, Arrays.asList(theValues));
|
||||
}
|
||||
}
|
||||
|
||||
private class StringMatches implements IStringMatch {
|
||||
@Override
|
||||
public ICriterion<StringClientParam> value(String theValue) {
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SearchParameter extends BaseQueryParameter {
|
|||
ourParamTypes.put(StringParam.class, RestSearchParameterTypeEnum.STRING);
|
||||
ourParamTypes.put(StringOrListParam.class, RestSearchParameterTypeEnum.STRING);
|
||||
ourParamTypes.put(StringAndListParam.class, RestSearchParameterTypeEnum.STRING);
|
||||
ourParamQualifiers.put(RestSearchParameterTypeEnum.STRING, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING));
|
||||
ourParamQualifiers.put(RestSearchParameterTypeEnum.STRING, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_STRING_CONTAINS, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING));
|
||||
|
||||
ourParamTypes.put(UriParam.class, RestSearchParameterTypeEnum.URI);
|
||||
ourParamTypes.put(UriOrListParam.class, RestSearchParameterTypeEnum.URI);
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SearchParameter extends BaseQueryParameter {
|
|||
ourParamTypes.put(StringParam.class, RestSearchParameterTypeEnum.STRING);
|
||||
ourParamTypes.put(StringOrListParam.class, RestSearchParameterTypeEnum.STRING);
|
||||
ourParamTypes.put(StringAndListParam.class, RestSearchParameterTypeEnum.STRING);
|
||||
ourParamQualifiers.put(RestSearchParameterTypeEnum.STRING, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING));
|
||||
ourParamQualifiers.put(RestSearchParameterTypeEnum.STRING, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_STRING_CONTAINS, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING));
|
||||
|
||||
ourParamTypes.put(UriParam.class, RestSearchParameterTypeEnum.URI);
|
||||
ourParamTypes.put(UriOrListParam.class, RestSearchParameterTypeEnum.URI);
|
||||
|
|
Loading…
Reference in New Issue