public static class GCEnumValue.EnumChoice
extends java.lang.Object
implements java.lang.Comparable
Constructor and Description |
---|
EnumChoice(java.lang.String value,
java.lang.String displayName)
Construct an
EnumChoice instance. |
EnumChoice(java.lang.String value,
java.lang.String displayName,
java.lang.String displayNameRef)
Construct an
EnumChoice instance. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object o)
Implementation of
Comparable interface. |
boolean |
equals(java.lang.Object o)
Return true if the passed
Object is an EnumChoice instance
and this instance's value matches the passed instance's value. |
java.lang.String |
getDisplayName()
Return the display name
String for this instance. |
java.lang.String |
getDisplayNameRef()
Return the display name localization reference for this instance.
|
java.lang.String |
getValue()
Return the value for this instance.
|
boolean |
hasBeenModified()
Return
true if this instance has been modified. |
int |
hashCode()
Return the hash code for this instance.
|
void |
localize(LocalizedMessageSource messageSource)
Localize the display name if there is a localization refs for it.
|
void |
resetModified()
Reset the modified flag for this instance such that
hasBeenModified()
will return false . |
public EnumChoice(java.lang.String value, java.lang.String displayName) throws GCVException
EnumChoice
instance.value
- String
value for choice.displayName
- String
for use in user interface naming
the enum choice.GCVException
- thrown if:
value
is null
or emptydisplayName
is null
or emptypublic EnumChoice(java.lang.String value, java.lang.String displayName, java.lang.String displayNameRef) throws GCVException
EnumChoice
instance.value
- String
value for choice.displayName
- String
for use in user interface naming
the enum choice.GCVException
- thrown if:
value
is null
or emptydisplayName
is null
or emptypublic boolean hasBeenModified()
true
if this instance has been modified.
The instance is considered to have been modified if a change was made
that affects the persistent representation since:
resetModified()
was last calledtrue
or false
resetModified()
public void resetModified()
hasBeenModified()
will return false
.hasBeenModified()
public java.lang.String getValue()
null
, non-empty value.public java.lang.String getDisplayName()
String
for this instance.null
, non-empty String
.public java.lang.String getDisplayNameRef()
String
, or null
.public int hashCode()
String
.hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
Object
is an EnumChoice
instance
and this instance's value matches the passed instance's value.equals
in class java.lang.Object
true
or false
public int compareTo(java.lang.Object o)
Comparable
interface.
Returns -1
if passed Object
is not an EnumChoice
, otherwise,
returns getValue().compareTo(((EnumChoice)o).getValue())
.compareTo
in interface java.lang.Comparable
public void localize(LocalizedMessageSource messageSource)
If the display name localization refs, but the localized string
cannot be located in the passed LocalizedMessageSource
it is left unlocalized.
messageSource
- Source for localized strings.