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.api.model.resolver;
019
020import java.util.List;
021
022import org.nuxeo.ecm.core.schema.types.resolver.ObjectResolver;
023
024/**
025 * Object to resolve entities referenced by a property. Works only on properties whose type has an object resolver.
026 *
027 * @since 7.1
028 */
029public interface PropertyObjectResolver {
030
031    /**
032     * {@link ObjectResolver#getManagedClasses()}
033     *
034     * @since 7.2
035     */
036    List<Class<?>> getManagedClasses();
037
038    /**
039     * {@link ObjectResolver#validate(Object)}
040     *
041     * @since 7.1
042     */
043    boolean validate();
044
045    /**
046     * {@link ObjectResolver#fetch(Object)}
047     *
048     * @since 7.1
049     */
050    Object fetch();
051
052    /**
053     * {@link ObjectResolver#fetch(Class, Object)}
054     *
055     * @since 7.1
056     */
057    <T> T fetch(Class<T> type);
058
059    /**
060     * Gets a reference to the object and set the corresponding value to this property.
061     * {@link ObjectResolver#fetch(Class, Object)}
062     *
063     * @since 7.1
064     */
065    void setObject(Object object);
066
067    /**
068     * Returns the underlying {@link ObjectResolver}.
069     *
070     * @since 7.1
071     */
072    ObjectResolver getObjectResolver();
073
074}