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

com.googlecode.gwt.test.internal.resources.DataResourceCallback Maven / Gradle / Ivy

There is a newer version: 0.63
Show newest version
package com.googlecode.gwt.test.internal.resources;

import com.google.gwt.resources.client.DataResource;
import com.google.gwt.safehtml.shared.UriUtils;

import java.lang.reflect.Method;

/**
 * Callback interface where {@link DataResource } methods calls are redirected. For internal
 * use only.
 *
 * @author Gael Lazzari
 */
class DataResourceCallback implements ResourcePrototypeCallback {

    private final String url;

    DataResourceCallback(String url) {
        this.url = url;
    }

    public Object call(Method method, Object[] args) throws Exception {
        if (method.getName().equals("getUrl")) {
            return url;
        } else if (method.getName().equals("getSafeUri")) {
            return UriUtils.fromTrustedString(url);
        }

        return null;

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy