/*
* pjftp FTP server.
* Copyright (C) 2012 Dmitriy Simbiriatin <dmitriy.simbiriatin@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package ds.pjftp.representation;
import ds.pjftp.representation.impl.AsciiRepresentation;
import ds.pjftp.representation.impl.ImageRepresentation;
/**
* This static class is used only for creating an appropriate instance of
* {@link Representation} class.
*/
public final class Representations {
/**
* Upper case flag, which indicates ASCII representation.
*/
public static final char ASCII_UP = 'A';
/**
* Lower case flag, which indicates ASCII representation.
*/
public static final char ASCII_LOW = 'a';
/**
* Upper case flag, which indicates Image representation.
*/
public static final char IMAGE_UP = 'I';
/**
* Lower case flag, which indicates Image representation.
*/
public static final char IMAGE_LOW = 'i';
private Representations() {
// Not used here.
}
/**
* Returns an implementation of Representation class depending on
* specified character flag.
* @param type representation type.
* @return appropriate implementation of Representation class.
*/
public static Representation get(final char type) {
switch (type) {
case ASCII_UP: case ASCII_LOW:
return new AsciiRepresentation();
case IMAGE_UP: case IMAGE_LOW:
return new ImageRepresentation();
default:
return null;
}
}
}