|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.novell.nds.dirxml.engine.gcv.GCValue
com.novell.nds.dirxml.engine.gcv.GCEnumValue
public class GCEnumValue
Class representing "enum" type Global Configuration Values.
GCVs of type "enum" must have a value that corresponds to one of the GCV's enum choices.
"enum" GCVs may have one or more enum choices. Each choice
is a non-null
, non-empty string that represents a possible
value for the GCV.
Enum choices are represented by an inner class of GCEnumValue
named EnumChoice
.
Enum choices have a defined order according to how the choices
are added to the GCEnumValue
. The order is maintained when
creating XML and when constructing a GCEnumValue
from XML. The
order is maintained solely for user interface purposes. The
order does not affect the value.
Enum choice values and the value of an enum GCV must match the following production:
String ::= Char*
The default value of a newly-constructed GCEnumValue
object is ""
.
Note that this is an invalid value. The newly-constructed value is not
valid until a an enum choice has been set.
Nested Class Summary | |
---|---|
static class |
GCEnumValue.EnumChoice
Class representing a single enum choice. |
Nested classes/interfaces inherited from class com.novell.nds.dirxml.engine.gcv.GCValue |
---|
GCValue.IllegalCloneStateException, GCValue.XmlComment, GCValue.XmlItem, GCValue.XmlProcessingInstruction |
Field Summary |
---|
Fields inherited from class com.novell.nds.dirxml.engine.gcv.GCValue |
---|
modified, parent, TYPE_BOOLEAN, TYPE_DN, TYPE_DN_REF, TYPE_ENUM, TYPE_GCV_REF, TYPE_GROUP, TYPE_HEADER, TYPE_INTEGER, TYPE_LIST, TYPE_PASSWORD_REF, TYPE_REAL, TYPE_STRING, TYPE_STRUCTURED, TYPE_SUBORDINATES, xmlItems |
Method Summary | |
---|---|
void |
appendEnumChoice(GCEnumValue.EnumChoice enumChoice)
Append a new enum choice to the choices in this instance. |
void |
appendEnumChoice(String enumString,
String displayName)
Append a new enum choice to the choices in this instance. |
void |
appendEnumChoice(String enumString,
String displayName,
String displayNameRef)
Append a new enum choice to the choices in this instance. |
GCValue |
cloneValue(String name)
Clone this GCValue instance and return the cloned instance. |
GCEnumValue.EnumChoice |
getEnumChoice(String enumString)
Return the EnumChoice instance for the passed enum value string. |
String |
getValue()
Return the current value of this instance. |
boolean |
hasBeenModified()
Return true if this instance has been modified. |
void |
insertEnumChoice(GCEnumValue.EnumChoice enumChoice,
GCEnumValue.EnumChoice insertionPoint)
Insert a new enum choice in front of an existing enum choice. |
void |
insertEnumChoice(String enumString,
String displayName,
String insertionPoint)
Insert a new enum choice in front of an existing enum choice. |
void |
insertEnumChoice(String enumString,
String displayName,
String displayNameRef,
String insertionPoint)
Insert a new enum choice in front of an existing enum choice. |
Iterator |
iterator()
Return an Iterator for use in iterating through the
EnumChoice objects in this GCEnumValue instance. |
void |
localize(LocalizedMessageSource messageSource)
Localize the display name and/or descriptions if there are localization refs for them. |
void |
parseValue(String value)
Parse the passed value based on the type and instance rules for "enum" GCVs. |
boolean |
removeEnumChoice(GCEnumValue.EnumChoice enumChoice)
Remove an existing enum choice from the current enum choices. |
boolean |
removeEnumChoice(String enumValue)
Remove an existing enum choice from the current enum choices. |
void |
resetModified()
Reset the modified flag for this instance such that hasBeenModified()
will return false . |
void |
setValue(String value)
Set the value for this instance. |
Methods inherited from class com.novell.nds.dirxml.engine.gcv.GCValue |
---|
addXmlComment, addXmlItems, addXmlProcessingInstruction, cloneCommon, construct, construct, constructGCVRef, constructGCVRef, constructGroup, constructHeader, constructStructuredValue, constructSubordinates, getDescription, getDescriptionRef, getDisplayName, getDisplayNameRef, getHidden, getMandatory, getName, getOwner, getParent, getType, getTypeString, getXmlItemsIterator, getXMLValue, setDescription, setDescriptionRef, setDisplayName, setDisplayNameRef, setHidden, setMandatory, toXML, typeFromString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public GCValue cloneValue(String name)
GCValue
instance and return the cloned instance.
cloneValue
in class GCValue
the
- name for the cloned value.
public 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 called
hasBeenModified
in interface ConfigElement
hasBeenModified
in class GCValue
true
or false
resetModified()
public void resetModified()
hasBeenModified()
will return false
.
resetModified
in interface ConfigElement
resetModified
in class GCValue
hasBeenModified()
public void parseValue(String value) throws GCVException
The passed value must be equal to one of the enum choice values.
If there are no enum choice values GCVStateStateException
is thrown.
parseValue
in class GCValue
value
- Value String
to parse
GCVException
- thrown if value is null
, empty, or does not
equal one of the enum choice values.
GCVStateException
- thrown if no enum choices have been set.public String getValue()
If no enum choices have been set this will return the empty String
.
getValue
in class GCValue
String
.public void setValue(String value) throws GCVException
The passed value must be equal to one of the enum choice values.
If there are no enum choice values GCVStateStateException
is thrown.
setValue
in class GCValue
value
- Value string for this instance.
GCVException
- thrown if value is null
, empty, or does not
equal one of the enum choice values.
GCVStateException
- thrown if no enum choices have been set.public GCEnumValue.EnumChoice getEnumChoice(String enumString)
EnumChoice
instance for the passed enum value string.
enumString
- enum choice value string.
EnumChoice
instance or null
, if no enum choice has been set
that matches the passed enumString
value.public void appendEnumChoice(String enumString, String displayName) throws GCVException
enumString
- The String
value of the enum choice.displayName
- The String
containing the display name for use
in the user interface.
GCVException
- thrown if:
enumString
is empty or null
enumString
matches an existing enum value in this instancedisplayName
is empty or null
public void appendEnumChoice(String enumString, String displayName, String displayNameRef) throws GCVException
enumString
- The String
value of the enum choice.displayName
- The String
containing the display name for use
in the user interface.displayNameRef
- A string identifier in a Properties collection that can be
used with a LocalizedMessageSource instance.
GCVException
- thrown if:
enumString
is empty or null
enumString
matches an existing enum value in this instancedisplayName
is empty or null
public void appendEnumChoice(GCEnumValue.EnumChoice enumChoice) throws GCVException
enumChoice
- The new EnumChoice
instance to add.
GCVException
- thrown if the new EnumChoice
value matches an existing
enum choice in this instance.public void insertEnumChoice(String enumString, String displayName, String insertionPoint) throws GCVException
enumString
- The String
value of the enum choice.displayName
- The String
containing the display name for use
in the user interface.insertionPoint
- The String
value of the enum choice in front of which the
new enum choice is to be inserted. If this value is null
this method is equivalent
to calling appendEnumChoice(String, String)
.
GCVException
- thrown if:
enumString
is empty or null
enumString
matches an existing enum value in this instancedisplayName
is empty or null
insertionPoint
is non-null
and does not match any existing enum choicepublic void insertEnumChoice(String enumString, String displayName, String displayNameRef, String insertionPoint) throws GCVException
enumString
- The String
value of the enum choice.displayName
- The String
containing the display name for use
in the user interface.displayNameRef
- A string identifier in a Properties collection that can be
used with a LocalizedMessageSource instance.insertionPoint
- The String
value of the enum choice in front of which the
new enum choice is to be inserted. If this value is null
this method is equivalent
to calling appendEnumChoice(String, String)
.
GCVException
- thrown if:
enumString
is empty or null
enumString
matches an existing enum value in this instancedisplayName
is empty or null
insertionPoint
is non-null
and does not match any existing enum choicepublic void insertEnumChoice(GCEnumValue.EnumChoice enumChoice, GCEnumValue.EnumChoice insertionPoint) throws GCVException
enumChoice
- The new EnumChoice
instance to add.insertionPoint
- The EnumChoice
in front of which the new EnumChoice
is to
be inserted. If this value is null
this method is equivalent
to calling appendEnumChoice(EnumChoice)
.
GCVException
- thrown if:
enumChoice
value matches an existing enum choiceinsertionPoint
is non-null
and does not match any existing enum choicepublic boolean removeEnumChoice(String enumValue)
If the current value of this instance matches the enum choice that is being removed the value is set to the value of the first enum choice remaining in this instance.
If the last existing enum choice is removed from this instance the current value of this instance is set to the empty string.
enumValue
- value String
of the enum choice to remove.
true
if an enum choice was found and removed, false
otherwise.public boolean removeEnumChoice(GCEnumValue.EnumChoice enumChoice)
If the current value of this instance matches the enum choice that is being removed the value is set to the value of the first enum choice remaining in this instance.
If the last existing enum choice is removed from this instance the current value of this instance is set to the empty string.
enumChoice
- EnumChoice
instance to remove.
true
if the passed EnumChoice
was
in the instance and removed, false
otherwise.public Iterator iterator()
Iterator
for use in iterating through the
EnumChoice objects in this GCEnumValue
instance.
Iterator
that returns EnumChoice
objects.public void localize(LocalizedMessageSource messageSource)
If the display name or description has a localization refs, but the localized string
cannot be located in the passed LocalizedMessageSource
they are left unlocalized.
localize
in class GCValue
messageSource
- Source for localized strings.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |