SimplePathMapping.java 629 Bytes
/*
 * Decompiled with CFR 0_118.
 */
package com.day.jcr.vault.fs.api;

import com.day.jcr.vault.fs.api.PathMapping;

public class SimplePathMapping
implements PathMapping {
    private final String strip;
    private final String root;

    public SimplePathMapping(String strip, String root) {
        this.strip = strip;
        this.root = root;
    }

    public String map(String path) {
        if (path.startsWith(this.strip)) {
            StringBuilder b = new StringBuilder(this.root);
            b.append(path.substring(this.strip.length()));
            return b.toString();
        }
        return path;
    }
}