Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package net.sourceforge.jsdialect.util;
 
 import java.util.Map;
 
 public class ResourceUrlResolver {
 
     private final Map<StringStringcustomResourceUrls;
 
     public ResourceUrlResolver(Map<StringStringcustomResourceUrls) {
        this. = customResourceUrls;
    }
    public String getResourceUrlOrDefault(String resourceKey) {
        if (resourceIsCustomDefined(resourceKey)) {
            return customUrlForResourceKey(resourceKey);
        } else {
            return defaultUrlForResourceKey(resourceKey);
        }
    }
    private String customUrlForResourceKey(String resourceKey) {
        return .get(resourceKey);
    }
    private String defaultUrlForResourceKey(String resourceKey) {
        return JsDialectResources.getResourceUrl(resourceKey);
    }
    private boolean resourceIsCustomDefined(String resourceKey) {
        return .containsKey(resourceKey);
    }
New to GrepCode? Check out our FAQ X