de.alexkamp.sandbox.model.ReadOnlyMount.java Source code

Java tutorial

Introduction

Here is the source code for de.alexkamp.sandbox.model.ReadOnlyMount.java

Source

package de.alexkamp.sandbox.model;

/**
 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
 *
 * If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

import com.fasterxml.jackson.core.JsonGenerator;

import java.io.IOException;

/**
 * Created by akampmann on 3/16/15.
 */
public class ReadOnlyMount implements Mount {
    private final String origPath;
    private final String mountPath;

    public ReadOnlyMount(String origPath, String mountPath) {
        this.origPath = origPath;
        this.mountPath = mountPath;
    }

    @Override
    public String getMountPoint() {
        return mountPath;
    }

    @Override
    public void toJSON(JsonGenerator gen) throws IOException {
        gen.writeStartObject();

        gen.writeObjectField("type", "bind");
        gen.writeObjectField("origPath", origPath);
        gen.writeObjectField("mountPath", mountPath);

        gen.writeEndObject();
    }
}