org.debux.webmotion.site.FileContent.java Source code

Java tutorial

Introduction

Here is the source code for org.debux.webmotion.site.FileContent.java

Source

/*
 * #%L
 * Webmotion website
 * 
 * $Id$
 * $HeadURL$
 * %%
 * Copyright (C) 2011 - 2015 Debux
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public 
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
 * #L%
 */
package org.debux.webmotion.site;

import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;

/**
 * Present content of a file like java, jsp, ...
 * 
 * @author julien
 */
public class FileContent {

    protected String path;
    protected String content;

    public FileContent(String path, String content) {
        this.path = path;
        this.content = content;
    }

    public String getContent() {
        return StringEscapeUtils.escapeHtml4(content);
    }

    public void setContent(String content) {
        this.content = content;
    }

    public FileContent addContent(String content) {
        this.content += content;
        return this;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getName() {
        return StringUtils.substringAfterLast(path, "/");
    }
}