com.novell.nds.dirxml.engine.gcv
Class GCEnumValue.EnumChoice

java.lang.Object
  extended by com.novell.nds.dirxml.engine.gcv.GCEnumValue.EnumChoice
All Implemented Interfaces:
Comparable
Enclosing class:
GCEnumValue

public static class GCEnumValue.EnumChoice
extends Object
implements Comparable

Class representing a single enum choice.


Constructor Summary
GCEnumValue.EnumChoice(String value, String displayName)
          Construct an EnumChoice instance.
GCEnumValue.EnumChoice(String value, String displayName, String displayNameRef)
          Construct an EnumChoice instance.
 
Method Summary
 int compareTo(Object o)
          Implementation of Comparable interface.
 boolean equals(Object o)
          Return true if the passed Object is an EnumChoice instance and this instance's value matches the passed instance's value.
 String getDisplayName()
          Return the display name String for this instance.
 String getDisplayNameRef()
          Return the display name localization reference for this instance.
 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GCEnumValue.EnumChoice

public GCEnumValue.EnumChoice(String value,
                              String displayName)
                       throws GCVException
Construct an EnumChoice instance.

Parameters:
value - String value for choice.
displayName - String for use in user interface naming the enum choice.
Throws:
GCVException - thrown if:
  • value is null or empty
  • displayName is null or empty

GCEnumValue.EnumChoice

public GCEnumValue.EnumChoice(String value,
                              String displayName,
                              String displayNameRef)
                       throws GCVException
Construct an EnumChoice instance.

Parameters:
value - String value for choice.
displayName - String for use in user interface naming the enum choice.
Throws:
GCVException - thrown if:
  • value is null or empty
  • displayName is null or empty
Method Detail

hasBeenModified

public boolean hasBeenModified()
Return 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:

  1. The instance was constructed from an XML representation.
  2. resetModified() was last called

Returns:
true or false
See Also:
resetModified()

resetModified

public void resetModified()
Reset the modified flag for this instance such that hasBeenModified() will return false.

See Also:
hasBeenModified()

getValue

public String getValue()
Return the value for this instance.

Returns:
non-null, non-empty value.

getDisplayName

public String getDisplayName()
Return the display name String for this instance.

Returns:
non-null, non-empty String.

getDisplayNameRef

public String getDisplayNameRef()
Return the display name localization reference for this instance.

Returns:
non-empty String, or null.

hashCode

public int hashCode()
Return the hash code for this instance. The hash code is the hash code of the value String.

Overrides:
hashCode in class Object
Returns:
hash code

equals

public boolean equals(Object o)
Return true if the passed Object is an EnumChoice instance and this instance's value matches the passed instance's value.

Overrides:
equals in class Object
Returns:
true or false

compareTo

public int compareTo(Object o)
Implementation of Comparable interface. Returns -1 if passed Object is not an EnumChoice, otherwise, returns getValue().compareTo(((EnumChoice)o).getValue()).

Specified by:
compareTo in interface Comparable
Returns:
comparison result.

localize

public void localize(LocalizedMessageSource messageSource)
Localize the display name if there is a localization refs for it.

If the display name localization refs, but the localized string cannot be located in the passed LocalizedMessageSource it is left unlocalized.

Parameters:
messageSource - Source for localized strings.