001/*
002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Antoine Taillefer <ataillefer@nuxeo.com>
016 */
017package org.nuxeo.drive.service.impl;
018
019import java.io.Serializable;
020
021import org.nuxeo.drive.service.FileSystemItemFactory;
022
023/**
024 * Wrapper for a {@link FileSystemItemFactory} instance.
025 *
026 * @author Antoine Taillefer
027 */
028public class FileSystemItemFactoryWrapper implements Serializable {
029
030    private static final long serialVersionUID = 6038185061388418020L;
031
032    protected String docType;
033
034    protected String facet;
035
036    protected FileSystemItemFactory factory;
037
038    public FileSystemItemFactoryWrapper(String docType, String facet, FileSystemItemFactory factory) {
039        this.docType = docType;
040        this.facet = facet;
041        this.factory = factory;
042    }
043
044    public String getDocType() {
045        return docType;
046    }
047
048    public String getFacet() {
049        return facet;
050    }
051
052    public FileSystemItemFactory getFactory() {
053        return factory;
054    }
055
056    @Override
057    public String toString() {
058        StringBuilder sb = new StringBuilder();
059        sb.append(factory.getClass().getName());
060        sb.append("(docType=");
061        sb.append(getDocType());
062        sb.append("/facet=");
063        sb.append(getFacet());
064        sb.append(")");
065        return sb.toString();
066    }
067
068}