use of org.apache.servicecomb.common.rest.codec.param.QueryProcessorCreator.QueryProcessor in project incubator-servicecomb-java-chassis by apache.
the class TestQueryProcessor method createProcessor.
private ParamValueProcessor createProcessor(String name, Class<?> type, String defaultValue, boolean required, String collectionFormat) {
JavaType javaType = TypeFactory.defaultInstance().constructType(type);
QueryParameter queryParameter = new QueryParameter();
queryParameter.name(name).required(required).collectionFormat(collectionFormat).setDefaultValue(defaultValue);
if (javaType.isContainerType()) {
queryParameter.type(ArrayProperty.TYPE);
}
return new QueryProcessor(queryParameter, javaType);
}
use of org.apache.servicecomb.common.rest.codec.param.QueryProcessorCreator.QueryProcessor in project java-chassis by ServiceComb.
the class TestQueryProcessor method createProcessor.
private ParamValueProcessor createProcessor(String name, Class<?> type, String defaultValue, boolean required, String collectionFormat) {
JavaType javaType = TypeFactory.defaultInstance().constructType(type);
QueryParameter queryParameter = new QueryParameter();
queryParameter.name(name).required(required).collectionFormat(collectionFormat).setDefaultValue(defaultValue);
if (javaType.isContainerType()) {
queryParameter.type(ArrayProperty.TYPE);
}
return new QueryProcessor(queryParameter, javaType);
}
use of org.apache.servicecomb.common.rest.codec.param.QueryProcessorCreator.QueryProcessor in project java-chassis by ServiceComb.
the class QueryCodecTestBase method should_decode.
private void should_decode(HttpServletRequest request, Object decodedValue) {
Class<?> targetType = decodedValue == null ? Object.class : decodedValue.getClass();
QueryParameter queryParameter = new QueryParameter();
queryParameter.setCollectionFormat(codec.getCodecName());
if (targetType.isArray()) {
queryParameter.setType(ArrayProperty.TYPE);
}
QueryProcessor queryProcessor = new QueryProcessor(queryParameter, TypeFactory.defaultInstance().constructType(targetType));
Object values = codec.decode(queryProcessor, request);
assertThat(values).isEqualTo(decodedValue);
}
use of org.apache.servicecomb.common.rest.codec.param.QueryProcessorCreator.QueryProcessor in project incubator-servicecomb-java-chassis by apache.
the class QueryCodecTestBase method should_decode.
private void should_decode(HttpServletRequest request, Object decodedValue) {
Class<?> targetType = decodedValue == null ? Object.class : decodedValue.getClass();
QueryParameter queryParameter = new QueryParameter();
queryParameter.setCollectionFormat(codec.getCodecName());
if (targetType.isArray()) {
queryParameter.setType(ArrayProperty.TYPE);
}
QueryProcessor queryProcessor = new QueryProcessor(queryParameter, TypeFactory.defaultInstance().constructType(targetType));
Object values = codec.decode(queryProcessor, request);
assertThat(values).isEqualTo(decodedValue);
}
Aggregations