KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > core > enums > LabeledEnumResolver


1 /*
2  * Copyright 2002-2005 the original author or authors.
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
17 package org.springframework.core.enums;
18
19 import java.util.Map JavaDoc;
20 import java.util.Set JavaDoc;
21
22 /**
23  * Interface for looking up <code>LabeledEnum</code> instances.
24  *
25  * @author Keith Donald
26  * @author Juergen Hoeller
27  * @since 1.2.2
28  */

29 public interface LabeledEnumResolver {
30
31     /**
32      * Return a set of enumerations of a particular type. Each element in the
33      * set should be an instance of LabeledEnum.
34      * @param type the enum type
35      * @return a set of localized enumeration instances for the provided type
36      * @throws IllegalArgumentException if the type is not supported
37      */

38     public Set JavaDoc getLabeledEnumSet(Class JavaDoc type) throws IllegalArgumentException JavaDoc;
39
40     /**
41      * Return a map of enumerations of a particular type. Each element in the
42      * map should be a key/value pair, where the key is the enum code, and the
43      * value is the <code>LabeledEnum</code> instance.
44      * @param type the enum type
45      * @return a Map of localized enumeration instances,
46      * with enum code as key and <code>LabeledEnum</code> instance as value
47      * @throws IllegalArgumentException if the type is not supported
48      */

49     public Map JavaDoc getLabeledEnumMap(Class JavaDoc type) throws IllegalArgumentException JavaDoc;
50
51     /**
52      * Resolve a single <code>LabeledEnum</code> by its identifying code.
53      * @param type the enum type
54      * @param code the enum code
55      * @return the enum
56      * @throws IllegalArgumentException if the code did not map to a valid instance
57      */

58     public LabeledEnum getLabeledEnumByCode(Class JavaDoc type, Comparable JavaDoc code) throws IllegalArgumentException JavaDoc;
59
60     /**
61      * Resolve a single <code>LabeledEnum</code> by its identifying code.
62      * @param type the enum type
63      * @param label the enum label
64      * @return the enum
65      * @throws IllegalArgumentException if the label did not map to a valid instance
66      */

67     public LabeledEnum getLabeledEnumByLabel(Class JavaDoc type, String JavaDoc label) throws IllegalArgumentException JavaDoc;
68
69 }
70
Popular Tags