SRJRCFrames
v0.1.296

de.schwarzrot.data.access.support
Class EntityEnumResolver

java.lang.Object
  extended by de.schwarzrot.data.access.support.EntityEnumResolver
All Implemented Interfaces:
LabeledEnumResolver

public class EntityEnumResolver
extends Object
implements LabeledEnumResolver

an enum-resolver class, that uses catalog/EntityManager to interface persistence and: - is designed as singleton, to be useful, where application services are not accessible - caches the enums - uses StaticLabeledEnumResolver as fallback for enums, that are not enitities - has a refresh()-call to reload the internal cache

Author:
Reinhard Mantey

Constructor Summary
EntityEnumResolver()
           
 
Method Summary
protected  void checkEnumCache4Type(Class clazz)
          internal call to load enums of given type, if they are not already found in cache.
 StaticLabeledEnumResolver getFallback()
           
 LabeledEnum getLabeledEnumByCode(Class clazz, Comparable code)
           
 LabeledEnum getLabeledEnumByLabel(Class clazz, String label)
           
 Map getLabeledEnumMap(Class clazz)
           
 Set getLabeledEnumSet(Class clazz)
           
static EntityEnumResolver instance()
           
static void refresh()
          as this class is intended to handle enums, that a user may extend, a call to refresh the cache(s) is evident.
 void setFallback(StaticLabeledEnumResolver fallback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityEnumResolver

public EntityEnumResolver()
Method Detail

getFallback

public final StaticLabeledEnumResolver getFallback()

getLabeledEnumByCode

public LabeledEnum getLabeledEnumByCode(Class clazz,
                                        Comparable code)
                                 throws IllegalArgumentException
Specified by:
getLabeledEnumByCode in interface LabeledEnumResolver
Throws:
IllegalArgumentException

getLabeledEnumByLabel

public LabeledEnum getLabeledEnumByLabel(Class clazz,
                                         String label)
                                  throws IllegalArgumentException
Specified by:
getLabeledEnumByLabel in interface LabeledEnumResolver
Throws:
IllegalArgumentException

getLabeledEnumMap

public Map getLabeledEnumMap(Class clazz)
                      throws IllegalArgumentException
Specified by:
getLabeledEnumMap in interface LabeledEnumResolver
Throws:
IllegalArgumentException

getLabeledEnumSet

public Set getLabeledEnumSet(Class clazz)
                      throws IllegalArgumentException
Specified by:
getLabeledEnumSet in interface LabeledEnumResolver
Throws:
IllegalArgumentException

setFallback

public final void setFallback(StaticLabeledEnumResolver fallback)

checkEnumCache4Type

protected void checkEnumCache4Type(Class clazz)
internal call to load enums of given type, if they are not already found in cache.

Parameters:
clazz - - class of enums that should be loaded

instance

public static final EntityEnumResolver instance()

refresh

public static void refresh()
as this class is intended to handle enums, that a user may extend, a call to refresh the cache(s) is evident.


SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.