All Downloads are FREE. Search and download functionalities are using the official Maven repository.

internal.org.springframework.content.rest.mappingcontext.RequestMappingToLinkrelMappingContext Maven / Gradle / Ivy

There is a newer version: 3.0.15
Show newest version
package internal.org.springframework.content.rest.mappingcontext;

import org.springframework.content.commons.mappingcontext.ClassWalker;

import java.util.HashMap;
import java.util.Map;

public class RequestMappingToLinkrelMappingContext {

    private Map, Map> mappings = new HashMap, Map>();

    public RequestMappingToLinkrelMappingContext() {}

    public Map getMappings(Class domainClass) {

        Map mappings = this.mappings.get(domainClass);
        if (mappings == null) {
            mappings = resolveMappings(domainClass);
        }
        return mappings;
    }

    private Map resolveMappings(Class domainClass) {
        RequestMappingToLinkrelMappingBuilder visitor = new RequestMappingToLinkrelMappingBuilder();
        ClassWalker walker = new ClassWalker(visitor);
        walker.accept(domainClass);
        Map mappings = visitor.getRequestMappings();
        this.mappings.put(domainClass, mappings);
        return mappings;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy