View Javadoc

1   // SECTION-START[License Header]
2   // <editor-fold defaultstate="collapsed" desc=" Generated License ">
3   /*
4    *   Java Object Management and Configuration
5    *   Copyright (C) Christian Schulte, 2005-206
6    *   All rights reserved.
7    *
8    *   Redistribution and use in source and binary forms, with or without
9    *   modification, are permitted provided that the following conditions
10   *   are met:
11   *
12   *     o Redistributions of source code must retain the above copyright
13   *       notice, this list of conditions and the following disclaimer.
14   *
15   *     o Redistributions in binary form must reproduce the above copyright
16   *       notice, this list of conditions and the following disclaimer in
17   *       the documentation and/or other materials provided with the
18   *       distribution.
19   *
20   *   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21   *   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22   *   AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23   *   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
24   *   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25   *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26   *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27   *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28   *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29   *   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30   *
31   *   $JOMC: Scope.java 4881 2014-02-20 22:55:53Z schulte $
32   *
33   */
34  // </editor-fold>
35  // SECTION-END
36  package org.jomc.spi;
37  
38  import java.util.Map;
39  
40  // SECTION-START[Documentation]
41  // <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
42  /**
43   * Scope a specification applies to.
44   *
45   * <dl>
46   *   <dt><b>Identifier:</b></dt><dd>org.jomc.spi.Scope</dd>
47   *   <dt><b>Multiplicity:</b></dt><dd>Many</dd>
48   *   <dt><b>Scope:</b></dt><dd>None</dd>
49   * </dl>
50   *
51   * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0
52   * @version 1.0
53   * @see org.jomc.ObjectManager#getObject(java.lang.Class) getObject(Scope[].class)
54   * @see org.jomc.ObjectManager#getObject(java.lang.Class,java.lang.String) getObject(Scope.class, "<i>implementation name</i>")
55   * @see org.jomc.ObjectManagerFactory
56   */
57  // </editor-fold>
58  // SECTION-END
59  // SECTION-START[Annotations]
60  // <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
61  @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6" )
62  // </editor-fold>
63  // SECTION-END
64  public interface Scope
65  {
66      // SECTION-START[Scope]
67  
68      /**
69       * Gets the objects of the scope.
70       *
71       * @return The objects of the scope or {@code null}.
72       */
73      Map<String, Object> getObjects();
74  
75      /**
76       * Gets an object from the scope.
77       *
78       * @param identifier The identifier of the object to get from the scope.
79       *
80       * @return The object identified by {@code identifier} or {@code null}, if no such object exists in the scope.
81       *
82       * @throws NullPointerException if {@code identifier} is {@code null}.
83       */
84      Object getObject( String identifier ) throws NullPointerException;
85  
86      /**
87       * Puts an object into the scope.
88       *
89       * @param identifier The identifier of the object to put into the scope.
90       * @param object The object to put into the scope.
91       *
92       * @return The previous object from the scope or {@code null}, if there was no object in the scope.
93       *
94       * @throws NullPointerException if {@code identifier} or {@code object} is {@code null}.
95       */
96      Object putObject( String identifier, Object object ) throws NullPointerException;
97  
98      /**
99       * 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 }