Merge pull request #912 from InfiniteLoop90/911-contains-modifier
Fixes #911 - Adds support for :contains modifier
This commit is contained in:
commit
d50dda19ae
|
@ -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