
package org.lastaflute.web.ruts.process.pathparam;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * @author jflute
 */
public class RequestPathParam {

    // ===================================================================================
    //                                                                           Attribute
    //                                                                           =========
    protected final List<Class<?>> pathParamTypeList; // not null, read-only
    protected final Map<Integer, Object> pathParamValueMap; // not null, read-only

    // ===================================================================================
    //                                                                         Constructor
    //                                                                         ===========
    public RequestPathParam(List<Class<?>> pathParamTypeList, Map<Integer, Object> pathParamValueMap) {
        this.pathParamTypeList = toUnmodifiableList(pathParamTypeList);
        this.pathParamValueMap = toUnmodifiableMap(pathParamValueMap);
    }

    protected List<Class<?>> toUnmodifiableList(List<Class<?>> pathParamTypeList) {
        return Collections.unmodifiableList(pathParamTypeList);
    }

    protected Map<Integer, Object> toUnmodifiableMap(Map<Integer, Object> pathParamValueMap) {
        return Collections.unmodifiableMap(pathParamValueMap);
    }

    // ===================================================================================
    //                                                                      Basic Override
    //                                                                      ==============
    @Override
    public String toString() {
        return "pathParam:{" + pathParamValueMap + "}";
    }

    // ===================================================================================
    //                                                                            Accessor
    //                                                                            ========
    public List<Class<?>> getPathParamTypeList() {
        return pathParamTypeList;
    }

    public Map<Integer, Object> getPathParamValueMap() {
        return pathParamValueMap;
    }
}
