#306 - Renamed type references types to allow more concise usage.
Renamed the Resource, Resources and PagedResources types in TypeReferences to *Type so that new TypeReferences.Resources<User>() {} now becomes new ResourcesType<User>() {}.
Prior to this change a static import of TypeReferences would've cause the actual Resource types to be fully qualified.
This commit is contained in:
@@ -40,7 +40,8 @@ public class TypeReferences {
|
||||
* @author Oliver Gierke
|
||||
* @since 0.17
|
||||
*/
|
||||
public static class Resource<T> extends SyntheticParameterizedTypeReference<org.springframework.hateoas.Resource<T>> {}
|
||||
public static class ResourceType<T> extends
|
||||
SyntheticParameterizedTypeReference<org.springframework.hateoas.Resource<T>> {}
|
||||
|
||||
/**
|
||||
* A {@link ParameterizedTypeReference} to return a {@link org.springframework.hateoas.Resources} of some type.
|
||||
@@ -48,7 +49,7 @@ public class TypeReferences {
|
||||
* @author Oliver Gierke
|
||||
* @since 0.17
|
||||
*/
|
||||
public static class Resources<T> extends
|
||||
public static class ResourcesType<T> extends
|
||||
SyntheticParameterizedTypeReference<org.springframework.hateoas.Resources<T>> {}
|
||||
|
||||
/**
|
||||
@@ -57,7 +58,7 @@ public class TypeReferences {
|
||||
* @author Oliver Gierke
|
||||
* @since 0.17
|
||||
*/
|
||||
public static class PagedResources<T> extends
|
||||
public static class PagedResourcesType<T> extends
|
||||
SyntheticParameterizedTypeReference<org.springframework.hateoas.PagedResources<T>> {}
|
||||
|
||||
/**
|
||||
@@ -71,7 +72,7 @@ public class TypeReferences {
|
||||
|
||||
private final Type type;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings({ "rawtypes", "deprecation" })
|
||||
protected SyntheticParameterizedTypeReference() {
|
||||
|
||||
Class<? extends SyntheticParameterizedTypeReference> foo = getClass();
|
||||
|
||||
@@ -34,6 +34,8 @@ import org.springframework.hateoas.Resource;
|
||||
import org.springframework.hateoas.Resources;
|
||||
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
||||
import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType;
|
||||
import org.springframework.hateoas.mvc.TypeReferences.ResourceType;
|
||||
import org.springframework.hateoas.mvc.TypeReferences.ResourcesType;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -83,7 +85,7 @@ public class TypeReferencesIntegrationTests {
|
||||
server.expect(requestTo("/resource")).andRespond(withSuccess(RESOURCE, MediaTypes.HAL_JSON));
|
||||
|
||||
ResponseEntity<Resource<User>> response = template.exchange("/resource", HttpMethod.GET, null,
|
||||
new TypeReferences.Resource<User>() {});
|
||||
new ResourceType<User>() {});
|
||||
|
||||
assertExpectedUserResource(response.getBody());
|
||||
}
|
||||
@@ -97,7 +99,7 @@ public class TypeReferencesIntegrationTests {
|
||||
server.expect(requestTo("/resources")).andRespond(withSuccess(RESOURCES_OF_USER, MediaTypes.HAL_JSON));
|
||||
|
||||
ResponseEntity<Resources<User>> response = template.exchange("/resources", HttpMethod.GET, null,
|
||||
new TypeReferences.Resources<User>() {});
|
||||
new ResourcesType<User>() {});
|
||||
Resources<User> body = response.getBody();
|
||||
|
||||
assertThat(body.hasLink("self"), is(true));
|
||||
@@ -117,7 +119,7 @@ public class TypeReferencesIntegrationTests {
|
||||
server.expect(requestTo("/resources")).andRespond(withSuccess(RESOURCES_OF_RESOURCE, MediaTypes.HAL_JSON));
|
||||
|
||||
ResponseEntity<Resources<Resource<User>>> response = template.exchange("/resources", HttpMethod.GET, null,
|
||||
new TypeReferences.Resources<Resource<User>>() {});
|
||||
new ResourcesType<Resource<User>>() {});
|
||||
Resources<Resource<User>> body = response.getBody();
|
||||
|
||||
assertThat(body.hasLink("self"), is(true));
|
||||
|
||||
Reference in New Issue
Block a user