public class StringEnumFieldValue extends java.lang.Object implements FieldValue
GUID.UID_REC_STATUS
or GUID.UID_REC_COLOR_MODE
.
Use Item.getStringEnumValue(com.canto.cumulus.GUID)
to get this wrapper class object. You can then use Item.setStringEnumValue(com.canto.cumulus.GUID, StringEnumFieldValue)
to set the field value back into the item.
You can use the wrapper object from one item to save it to another item but both have to belong to the same catalog.Constructor and Description |
---|
StringEnumFieldValue(FieldDefinition fieldDefinition)
Creates a new instance for the given string enum field.
|
Modifier and Type | Method and Description |
---|---|
void |
clearValue()
Clear the field's value.
|
java.lang.String |
getDisplayString()
Return the field's value as a string that can be displayed to the user.
|
java.lang.String |
getDisplayString(java.util.Locale locale)
Return the field's value as a string that can be displayed to the user.
|
int |
getID()
Get the ID of the string list value.
|
java.util.Set<java.lang.Integer> |
getIDs()
Get the IDs of this field value.
|
boolean |
hasValue()
Return whether this field has a value.
|
void |
setFromDisplayString(java.util.Locale locale,
java.lang.String value)
Set the field value from a display string.
|
void |
setFromDisplayString(java.lang.String value)
Set the field value from a display string.
|
void |
setID(int enumID)
Set the ID of this string list value.
|
void |
setIDs(java.util.Set<java.lang.Integer> ids)
Set the field value to the given set of string list IDs.
|
boolean |
supportsMultipleValues()
Return whether this field is defined to support multiple values.
|
java.lang.String |
toString()
Same as
getDisplayString() . |
public StringEnumFieldValue(FieldDefinition fieldDefinition)
fieldDefinition
- string enum fieldpublic boolean hasValue()
hasValue
in interface FieldValue
true
if the field has a value, false
otherwise.public void clearValue()
Item.save()
to save this change back to the catalog.clearValue
in interface FieldValue
public java.lang.String getDisplayString()
getDisplayString
in interface FieldValue
public java.lang.String getDisplayString(java.util.Locale locale)
getDisplayString
in interface FieldValue
locale
- The locale to use for the language selection.public void setFromDisplayString(java.lang.String value) throws InvalidArgumentException
Item.save()
to save this change back to the catalog.
This method uses the current locale for the language selection.setFromDisplayString
in interface FieldValue
value
- The display string to set the value from.InvalidArgumentException
- if the display string is not of the right format.public void setFromDisplayString(java.util.Locale locale, java.lang.String value) throws InvalidArgumentException
Item.save()
to save this change back to the catalog.
This method uses the current locale for the language selection.setFromDisplayString
in interface FieldValue
value
- The display string to set the value from.locale
- The locale to use for formatting and language selection.InvalidArgumentException
- if the display string is not of the right format.public boolean supportsMultipleValues()
true
if this field supports multiple values, false
otherwise.public int getID()
public void setID(int enumID) throws InvalidArgumentException
Item.save()
to save this change back to the catalog.enumID
- The new value of this string list field value.InvalidArgumentException
- if the ID is not validsetIDs(java.util.Set)
public java.util.Set<java.lang.Integer> getIDs()
public void setIDs(java.util.Set<java.lang.Integer> ids) throws InvalidArgumentException
Item.save()
to save this change back to the catalog.ids
- The string list IDs to be the new field value.InvalidArgumentException
- if one of the given IDs is not valid.public java.lang.String toString()
getDisplayString()
.toString
in class java.lang.Object
www.canto.com
Canto, the Canto logo, the Cumulus logo, and Cumulus are registered trademarks of Canto GmbH, registered in the U.S. and other countries.