001// SECTION-START[License Header]
002// <editor-fold defaultstate="collapsed" desc=" Generated License ">
003/*
004 *   Java Object Management and Configuration
005 *   Copyright (C) Christian Schulte, 2005-206
006 *   All rights reserved.
007 *
008 *   Redistribution and use in source and binary forms, with or without
009 *   modification, are permitted provided that the following conditions
010 *   are met:
011 *
012 *     o Redistributions of source code must retain the above copyright
013 *       notice, this list of conditions and the following disclaimer.
014 *
015 *     o Redistributions in binary form must reproduce the above copyright
016 *       notice, this list of conditions and the following disclaimer in
017 *       the documentation and/or other materials provided with the
018 *       distribution.
019 *
020 *   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
021 *   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
022 *   AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
023 *   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
024 *   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
025 *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
026 *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
027 *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
028 *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
029 *   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030 *
031 *   $JOMC: Scope.java 4795 2013-04-21 09:09:02Z schulte $
032 *
033 */
034// </editor-fold>
035// SECTION-END
036package org.jomc.spi;
037
038import java.util.Map;
039
040// SECTION-START[Documentation]
041// <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
042/**
043 * Scope a specification applies to.
044 *
045 * <dl>
046 *   <dt><b>Identifier:</b></dt><dd>org.jomc.spi.Scope</dd>
047 *   <dt><b>Multiplicity:</b></dt><dd>Many</dd>
048 *   <dt><b>Scope:</b></dt><dd>None</dd>
049 * </dl>
050 *
051 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0
052 * @version 1.0
053 * @see org.jomc.ObjectManager#getObject(java.lang.Class) getObject(Scope[].class)
054 * @see org.jomc.ObjectManager#getObject(java.lang.Class,java.lang.String) getObject(Scope.class, "<i>implementation name</i>")
055 * @see org.jomc.ObjectManagerFactory
056 */
057// </editor-fold>
058// SECTION-END
059// SECTION-START[Annotations]
060// <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
061@javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.5", comments = "See http://www.jomc.org/jomc/1.5/jomc-tools-1.5" )
062// </editor-fold>
063// SECTION-END
064public interface Scope
065{
066    // SECTION-START[Scope]
067
068    /**
069     * Gets the objects of the scope.
070     *
071     * @return The objects of the scope or {@code null}.
072     */
073    Map<String, Object> getObjects();
074
075    /**
076     * Gets an object from the scope.
077     *
078     * @param identifier The identifier of the object to get from the scope.
079     *
080     * @return The object identified by {@code identifier} or {@code null}, if no such object exists in the scope.
081     *
082     * @throws NullPointerException if {@code identifier} is {@code null}.
083     */
084    Object getObject( String identifier ) throws NullPointerException;
085
086    /**
087     * Puts an object into the scope.
088     *
089     * @param identifier The identifier of the object to put into the scope.
090     * @param object The object to put into the scope.
091     *
092     * @return The previous object from the scope or {@code null}, if there was no object in the scope.
093     *
094     * @throws NullPointerException if {@code identifier} or {@code object} is {@code null}.
095     */
096    Object putObject( String identifier, Object object ) throws NullPointerException;
097
098    /**
099     * Removes an object from the scope.
100     *
101     * @param identifier The identifier of the object to remove from the scope.
102     *
103     * @return The removed object or {@code null}, if there was no object in the scope.
104     *
105     * @throws NullPointerException if {@code identifier} is {@code null}.
106     */
107    Object removeObject( String identifier ) throws NullPointerException;
108
109    // SECTION-END
110}