View Javadoc

1   /*
2    * Copyright 2006-2016 The JGUIraffe Team.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License")
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.jguiraffe.resources;
17  
18  import java.util.Locale;
19  import java.util.MissingResourceException;
20  import java.util.Set;
21  
22  /**
23   * <p>
24   * Definition of an interface for resource groups.
25   * </p>
26   * <p>
27   * Resources can be organized in logical groups. Each group allows access to the
28   * resources it contains and to a collection of all available keys. The
29   * resources of a group all belong to the same <code>Locale</code>.
30   * </p>
31   *
32   * @author Oliver Heger
33   * @version $Id: ResourceGroup.java 205 2012-01-29 18:29:57Z oheger $
34   */
35  public interface ResourceGroup
36  {
37      /**
38       * Returns the name of this resource group. It is up to a concrete
39       * implementation what this name means in practice.
40       *
41       * @return the name of this resource group
42       */
43      Object getName();
44  
45      /**
46       * Returns a collection with the resource keys defined in this resource
47       * group. The keys in this collection can be passed to the
48       * <code>getResource()</code> method.
49       *
50       * @return the collection with defined resource keys
51       */
52      Set<Object> getKeys();
53  
54      /**
55       * Returns the <code>Locale</code> of this resource group
56       *
57       * @return the Locale
58       */
59      Locale getLocale();
60  
61      /**
62       * Returns the resource with the specified key. This is the main method for
63       * accessing resources in this group.
64       *
65       * @param key the resource key
66       * @return the resource with this key
67       * @throws MissingResourceException if the resource cannot be found
68       */
69      Object getResource(Object key) throws MissingResourceException;
70  }