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

com.github.yoojia.halo.Downloads Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package com.github.yoojia.halo;

/**
 * @author YOOJIA.CHEN ([email protected])
 */
public class Downloads {

    private static final String PATH_KEY = "[email protected]#" + Math.random();
    private static final String NAME_KEY = "[email protected]#" + Math.random();

    private final HaloRequest request;

    private Downloads(HaloRequest request) {
        this.request = request;
    }

    public static Downloads use(HaloRequest request){
        return new Downloads(request);
    }

    public Downloads setResourcePath(String filePath) {
        request.coreParams.put(PATH_KEY, filePath);
        return this;
    }

    public Downloads setResourceName(String name){
        request.coreParams.put(NAME_KEY, name);
        return this;
    }

    static String getResourcePath(HaloRequest request){
        return request.coreParams.containsKey(PATH_KEY) ?
                (String) request.coreParams.get(PATH_KEY) :
                null;
    }

    static String getResourceName(HaloRequest request){
        return request.coreParams.containsKey(NAME_KEY) ?
                (String) request.coreParams.get(NAME_KEY) :
                null;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy