001/*
002 * (C) Copyright 2015 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.io.registry.reflect;
021
022import org.nuxeo.ecm.core.io.registry.context.RenderingContext;
023
024/**
025 * Define the instantiation mode for this a marshaller.
026 * <p>
027 * The use of {@link #SINGLETON} is highly recommended.
028 * </p>
029 * <p>
030 * {@link #SINGLETON} marshallers are more priority than others.
031 * </p>
032 *
033 * @since 7.2
034 */
035public enum Instantiations {
036
037    /**
038     * The marshaller is instantiated once.
039     * <p>
040     * Each class with this instantiation mode should just have thread safe properties, or injected properties.
041     * </p>
042     * <p>
043     * Please note that injected {@link RenderingContext} is thread safe.
044     * </p>
045     */
046    SINGLETON,
047
048    /**
049     * One instance of the marshaller is created per thread.
050     */
051    PER_THREAD,
052
053    /**
054     * One instance of marshaller is created for each marshalling request.
055     */
056    EACH_TIME;
057
058}