|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.salespointframework.core.users.AbstractCapability
public abstract class AbstractCapability
Convenience class implementing basic capability behavior.
For convenience you can derive all your capability classes from
AbstractCapability
, which will manage names and display names.
Field Summary | |
---|---|
private java.lang.String |
m_sName
The name of the capability. |
private static java.util.Locale |
s_lLRU
The least recently used locale for looking up display names. |
private static java.util.ResourceBundle |
s_rbDisplayNames
The resource bundle that contains the display names for the capabilities. |
private static java.lang.String |
s_sBaseName
The base name for the resource bundles containing the capabilities' display names. |
Constructor Summary | |
---|---|
AbstractCapability(java.lang.String sName)
Create a new capability with a given name. |
Method Summary | |
---|---|
private static java.lang.String |
getCapabilityDisplayName(java.lang.String sName,
java.util.Locale l)
Get a capabilities display name depending on a locale. |
java.lang.String |
getDisplayName()
Get the display name of this capability using the default locale. |
java.lang.String |
getDisplayName(java.util.Locale l)
Get the display name of this capability according to a locale. |
java.lang.String |
getName()
Get the capability's name. |
abstract Capability |
getToggled()
Get the capability that is the inverse to this one. |
abstract boolean |
isGranted()
Return the grant state of this capability. |
static void |
setDisplayNameResourceBundleName(java.lang.String sBaseName)
Set the base name for the resouce bundle that contains the capabilities' display names. |
java.lang.String |
toString()
Return a string representation of this capability. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final java.lang.String m_sName
IMMUTABLE
private static java.util.ResourceBundle s_rbDisplayNames
private static java.util.Locale s_lLRU
private static java.lang.String s_sBaseName
Constructor Detail |
---|
public AbstractCapability(java.lang.String sName)
sName
- the name of the capability.Method Detail |
---|
public java.lang.String getName()
getName
in interface Capability
public java.lang.String getDisplayName()
This is identical to
getDisplayName (Locale.getDefault());
getDisplayName
in interface Capability
public java.lang.String getDisplayName(java.util.Locale l)
setDisplayNameResourceBundleName(java.lang.String)
.
getDisplayName
in interface Capability
l
- the locale according to which to get the display name
public abstract boolean isGranted()
isGranted
in interface Capability
public abstract Capability getToggled()
getToggled
in interface Capability
public java.lang.String toString()
The format of the returned string is:
display name <name>: grant state
toString
in class java.lang.Object
private static final java.lang.String getCapabilityDisplayName(java.lang.String sName, java.util.Locale l)
setDisplayNameResourceBundleName(java.lang.String)
and the locale.
The key will be:
capabilities.display_names.sName
sName
- the programmatical name of the capabilityl
- the locale that determines which resource bundle to use.ResourceBundle
public static final void setDisplayNameResourceBundleName(java.lang.String sBaseName)
capabilities.display_names.capability_name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |