internal.org.springframework.content.rest.mappingcontext.ContentPropertyToLinkrelMappingContext Maven / Gradle / Ivy
package internal.org.springframework.content.rest.mappingcontext;
import org.springframework.content.commons.mappingcontext.ClassWalker;
import java.util.HashMap;
import java.util.Map;
public class ContentPropertyToLinkrelMappingContext {
private Map, Map> mappings = new HashMap, Map>();
public ContentPropertyToLinkrelMappingContext() {}
public Map getMappings(Class> domainClass) {
Map mappings = this.mappings.get(domainClass);
if (mappings == null) {
mappings = resolveMappings(domainClass);
}
return mappings;
}
private Map resolveMappings(Class> domainClass) {
RestResourceMappingBuilder visitor = new RestResourceMappingBuilder((rr)->rr.linkRel());
ClassWalker walker = new ClassWalker(visitor);
walker.accept(domainClass);
Map mappings = visitor.getMappings();
this.mappings.put(domainClass, mappings);
return mappings;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy