001/*
002 * (C) Copyright 2014 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-2.1.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 *     Nicolas Chapurlat <nchapurlat@nuxeo.com>
016 */
017
018package org.nuxeo.ecm.core.schema.types.resolver;
019
020import org.nuxeo.common.xmap.annotation.XNode;
021import org.nuxeo.common.xmap.annotation.XObject;
022
023/**
024 * Handler for the {@link ObjectResolverService} "resolvers" extension point.
025 *
026 * @since 7.1
027 */
028@XObject("resolver")
029public class ObjectResolverDescriptor {
030
031    @XNode("@type")
032    private String type;
033
034    @XNode("@class")
035    private Class<? extends ObjectResolver> resolver;
036
037    public ObjectResolverDescriptor() {
038    }
039
040    public ObjectResolverDescriptor(String type, Class<? extends ObjectResolver> resolver) {
041        super();
042        this.type = type;
043        this.resolver = resolver;
044    }
045
046    public String getType() {
047        return type;
048    }
049
050    public void setType(String type) {
051        this.type = type;
052    }
053
054    public Class<? extends ObjectResolver> getResolver() {
055        return resolver;
056    }
057
058    public void setResolver(Class<? extends ObjectResolver> resolver) {
059        this.resolver = resolver;
060    }
061
062    @Override
063    public String toString() {
064        return type + ": " + resolver.getCanonicalName();
065    }
066
067}