001/*
002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nicolas Chapurlat <nchapurlat@nuxeo.com>
018 */
019
020package org.nuxeo.ecm.core.schema.types.resolver;
021
022import org.nuxeo.common.xmap.annotation.XNode;
023import org.nuxeo.common.xmap.annotation.XObject;
024
025/**
026 * Handler for the {@link ObjectResolverService} "resolvers" extension point.
027 *
028 * @since 7.1
029 */
030@XObject("resolver")
031public class ObjectResolverDescriptor {
032
033    @XNode("@type")
034    private String type;
035
036    @XNode("@class")
037    private Class<? extends ObjectResolver> resolver;
038
039    public ObjectResolverDescriptor() {
040    }
041
042    public ObjectResolverDescriptor(String type, Class<? extends ObjectResolver> resolver) {
043        super();
044        this.type = type;
045        this.resolver = resolver;
046    }
047
048    public String getType() {
049        return type;
050    }
051
052    public void setType(String type) {
053        this.type = type;
054    }
055
056    public Class<? extends ObjectResolver> getResolver() {
057        return resolver;
058    }
059
060    public void setResolver(Class<? extends ObjectResolver> resolver) {
061        this.resolver = resolver;
062    }
063
064    @Override
065    public String toString() {
066        return type + ": " + resolver.getCanonicalName();
067    }
068
069}