站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

AbstractCachingLabeledEnumResolver (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.core.enums
Class AbstractCachingLabeledEnumResolver

java.lang.Object
  extended by org.springframework.core.enums.AbstractCachingLabeledEnumResolver
All Implemented Interfaces:
LabeledEnumResolver
Direct Known Subclasses:
StaticLabeledEnumResolver

public abstract class AbstractCachingLabeledEnumResolver
extends Object
implements LabeledEnumResolver

Abstract base class for LabeledEnumResolver implementations, caching all retrieved LabeledEnum instances.

Subclasses need to implement the template method findLabeledEnums(type).

Since:
1.2.2
Author:
Keith Donald, Juergen Hoeller
See Also:
findLabeledEnums(Class)

Field Summary
protected  Log logger
           
 
Constructor Summary
AbstractCachingLabeledEnumResolver()
           
 
Method Summary
protected abstract  Set findLabeledEnums(Class type)
          Template method to be implemented by subclasses.
 LabeledEnum getLabeledEnumByCode(Class type, Comparable code)
          Resolve a single LabeledEnum by its identifying code.
 LabeledEnum getLabeledEnumByLabel(Class type, String label)
          Resolve a single LabeledEnum by its identifying code.
 Map getLabeledEnumMap(Class type)
          Return a map of enumerations of a particular type.
 Set getLabeledEnumSet(Class type)
          Return a set of enumerations of a particular type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final transient Log logger
Constructor Detail

AbstractCachingLabeledEnumResolver

public AbstractCachingLabeledEnumResolver()
Method Detail

getLabeledEnumSet

public Set getLabeledEnumSet(Class type)
                      throws IllegalArgumentException
Description copied from interface: LabeledEnumResolver
Return a set of enumerations of a particular type. Each element in the set should be an instance of LabeledEnum.

Specified by:
getLabeledEnumSet in interface LabeledEnumResolver
Parameters:
type - the enum type
Returns:
a set of localized enumeration instances for the provided type
Throws:
IllegalArgumentException - if the type is not supported

getLabeledEnumMap

public Map getLabeledEnumMap(Class type)
                      throws IllegalArgumentException
Description copied from interface: LabeledEnumResolver
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.

Specified by:
getLabeledEnumMap in interface LabeledEnumResolver
Parameters:
type - the enum type
Returns:
a Map of localized enumeration instances, with enum code as key and LabeledEnum instance as value
Throws:
IllegalArgumentException - if the type is not supported

getLabeledEnumByCode

public LabeledEnum getLabeledEnumByCode(Class type,
                                        Comparable code)
                                 throws IllegalArgumentException
Description copied from interface: LabeledEnumResolver
Resolve a single LabeledEnum by its identifying code.

Specified by:
getLabeledEnumByCode in interface LabeledEnumResolver
Parameters:
type - the enum type
code - the enum code
Returns:
the enum
Throws:
IllegalArgumentException - if the code did not map to a valid instance

getLabeledEnumByLabel

public LabeledEnum getLabeledEnumByLabel(Class type,
                                         String label)
                                  throws IllegalArgumentException
Description copied from interface: LabeledEnumResolver
Resolve a single LabeledEnum by its identifying code.

Specified by:
getLabeledEnumByLabel in interface LabeledEnumResolver
Parameters:
type - the enum type
label - the enum label
Returns:
the enum
Throws:
IllegalArgumentException - if the label did not map to a valid instance

findLabeledEnums

protected abstract Set findLabeledEnums(Class type)
Template method to be implemented by subclasses. Supposed to find all LabeledEnum instances for the given type.

Parameters:
type - the enum type
Returns:
the Set of LabeledEnum instances
See Also:
LabeledEnum


Copyright (c) 2002-2007 The Spring Framework Project.