List of usage examples for org.springframework.data.rest.core.mapping TypedResourceDescription defaultFor
public static ResourceDescription defaultFor(LinkRelation rel, String name, Class<?> type)
From source file:org.springframework.data.rest.webmvc.json.JacksonMetadata.java
/** * Returns the fallback {@link ResourceDescription} to be used for the given {@link BeanPropertyDefinition}. * /* w ww . ja v a 2s . c o m*/ * @param ownerMetadata must not be {@literal null}. * @param definition must not be {@literal null}. * @return */ public ResourceDescription getFallbackDescription(ResourceMetadata ownerMetadata, BeanPropertyDefinition definition) { Assert.notNull(ownerMetadata, "Owner's resource metadata must not be null!"); Assert.notNull(definition, "BeanPropertyDefinition must not be null!"); AnnotatedMember member = definition.getPrimaryMember(); Description description = member.getAnnotation(Description.class); ResourceDescription fallback = TypedResourceDescription.defaultFor(ownerMetadata.getItemResourceRel(), definition.getInternalName(), definition.getPrimaryMember().getRawType()); return description == null ? fallback : new AnnotationBasedResourceDescription(description, fallback); }