@Test public void retrievesDefaultValueWhenQueryParameterDoesNotPresentInRequest() throws Exception { when(parameter.getDefaultValue()).thenReturn("default"); when(typeProducer.createValue("foo", queryParameters, "default")).thenReturn("default"); Object resolvedHeader = queryParameterResolver.resolve(parameter, applicationContext); assertEquals("default", resolvedHeader); }
@Override public Object resolve(org.everrest.core.Parameter parameter, ApplicationContext context) throws Exception { String param = this.queryParam.value(); TypeProducer typeProducer = typeProducerFactory.createTypeProducer(parameter.getParameterClass(), parameter.getGenericType()); return typeProducer.createValue(param, context.getQueryParameters(!parameter.isEncoded()), parameter.getDefaultValue()); }
QueryParameterResolver implements ParameterResolver<QueryParam> { @Override public Object resolve(org.everrest.core.Parameter parameter, ApplicationContext context) throws Exception { String param = this.queryParam.value(); TypeProducer typeProducer = typeProducerFactory.createTypeProducer(parameter.getParameterClass(), parameter.getGenericType()); return typeProducer.createValue(param, context.getQueryParameters(!parameter.isEncoded()), parameter.getDefaultValue()); } }
QueryParameterResolver implements ParameterResolver<QueryParam> { @Override public Object resolve(org.everrest.core.Parameter parameter, ApplicationContext context) throws Exception { String param = this.queryParam.value(); TypeProducer typeProducer = typeProducerFactory.createTypeProducer(parameter.getParameterClass(), parameter.getGenericType()); return typeProducer.createValue(param, context.getQueryParameters(!parameter.isEncoded()), parameter.getDefaultValue()); } QueryParameterResolver(QueryParam queryParam, TypeProducerFactory typeProducerFactory); }
QueryParameterResolver implements ParameterResolver<QueryParam> { @Override public Object resolve(org.everrest.core.Parameter parameter, ApplicationContext context) throws Exception { String param = this.queryParam.value(); TypeProducer typeProducer = typeProducerFactory.createTypeProducer(parameter.getParameterClass(), parameter.getGenericType()); return typeProducer.createValue(param, context.getQueryParameters(!parameter.isEncoded()), parameter.getDefaultValue()); } QueryParameterResolver(QueryParam queryParam, TypeProducerFactory typeProducerFactory); @Override Object resolve(org.everrest.core.Parameter parameter, ApplicationContext context); }
QueryParameterResolver implements ParameterResolver<QueryParam> { @Override public Object resolve(org.everrest.core.Parameter parameter, ApplicationContext context) throws Exception { String param = this.queryParam.value(); TypeProducer typeProducer = typeProducerFactory.createTypeProducer(parameter.getParameterClass(), parameter.getGenericType()); return typeProducer.createValue(param, context.getQueryParameters(!parameter.isEncoded()), parameter.getDefaultValue()); } QueryParameterResolver(QueryParam queryParam, TypeProducerFactory typeProducerFactory); @Override Object resolve(org.everrest.core.Parameter parameter, ApplicationContext context);  }