org.springframework.core.enums
Interface LabeledEnumResolver

All Known Implementing Classes:
AbstractCachingLabeledEnumResolver, StaticLabeledEnumResolver

public interface LabeledEnumResolver

Interface for looking up LabeledEnum instances.

Since:
1.2.2
Author:
Keith Donald, Juergen Hoeller

Method Summary
 LabeledEnum getLabeledEnumByCode(java.lang.Class type, java.lang.Comparable code)
          Resolve a single LabeledEnum by its identifying code.
 LabeledEnum getLabeledEnumByLabel(java.lang.Class type, java.lang.String label)
          Resolve a single LabeledEnum by its identifying code.
 java.util.Map getLabeledEnumMap(java.lang.Class type)
          Return a map of enumerations of a particular type.
 java.util.Set getLabeledEnumSet(java.lang.Class type)
          Return a set of enumerations of a particular type.
 

Method Detail

getLabeledEnumSet

java.util.Set getLabeledEnumSet(java.lang.Class type)
                                throws java.lang.IllegalArgumentException
Return a set of enumerations of a particular type. Each element in the set should be an instance of LabeledEnum.

Parameters:
type - the enum type
Returns:
a set of localized enumeration instances for the provided type
Throws:
java.lang.IllegalArgumentException - if the type is not supported

getLabeledEnumMap

java.util.Map getLabeledEnumMap(java.lang.Class type)
                                throws java.lang.IllegalArgumentException
Return a map of enumerations of a particular type. Each element in the map should be a key/value pair, where the key is the enum code, and the value is the LabeledEnum instance.

Parameters:
type - the enum type
Returns:
a Map of localized enumeration instances, with enum code as key and LabeledEnum instance as value
Throws:
java.lang.IllegalArgumentException - if the type is not supported

getLabeledEnumByCode

LabeledEnum getLabeledEnumByCode(java.lang.Class type,
                                 java.lang.Comparable code)
                                 throws java.lang.IllegalArgumentException
Resolve a single LabeledEnum by its identifying code.

Parameters:
type - the enum type
code - the enum code
Returns:
the enum
Throws:
java.lang.IllegalArgumentException - if the code did not map to a valid instance

getLabeledEnumByLabel

LabeledEnum getLabeledEnumByLabel(java.lang.Class type,
                                  java.lang.String label)
                                  throws java.lang.IllegalArgumentException
Resolve a single LabeledEnum by its identifying code.

Parameters:
type - the enum type
label - the enum label
Returns:
the enum
Throws:
java.lang.IllegalArgumentException - if the label did not map to a valid instance


Copyright © 2002-2008 The Spring Framework.