public class DataSizeFieldValue extends java.lang.Object implements FieldValue, java.lang.Comparable<DataSizeFieldValue>
GUID.UID_REC_ASSET_DATA_SIZE_64BIT
, GUID.UID_REC_ASSET_DATA_SIZE
or GUID.UID_REC_ASSET_RSRC_SIZE
. This field type is actually a field value
interpretation for a basic field type of "Integer". The core value is exchanged as a long integer and is the number of bytes. Use Item.getDataSizeValue(com.canto.cumulus.GUID)
to get this wrapper class object. You can then use Item.setDataSizeValue(com.canto.cumulus.GUID, DataSizeFieldValue)
to set the field value back into the item.Constructor and Description |
---|
DataSizeFieldValue()
Create a new empty data size field value.
|
DataSizeFieldValue(long core)
Create a new data size field value from the given core field value.
|
Modifier and Type | Method and Description |
---|---|
void |
clearValue()
Clear the field's value.
|
int |
compareTo(DataSizeFieldValue other)
Compares this object with the specified object for order.
|
boolean |
equals(java.lang.Object o) |
long |
getCoreValue()
Get the core value (number of bytes) for this field value.
|
java.lang.String |
getDisplayString()
Get a string of this field value to be displayed to the user.
|
java.lang.String |
getDisplayString(java.util.Locale locale)
Get a string of this field value to be displayed to the user.
|
java.lang.String |
getDisplayString(java.util.Locale locale,
boolean useAllUnits)
Get a string of this field value to be displayed to the user.
|
int |
hashCode() |
boolean |
hasValue()
Return whether this field has a value.
|
void |
setCoreValue(long value)
Set this field value from a core value (number of bytes).
|
void |
setFromDisplayString(java.util.Locale locale,
java.lang.String value)
Set the field value from a display string using a specific locale for formatting and language selection.
|
void |
setFromDisplayString(java.lang.String value)
Set the field value from a display string.
|
java.lang.String |
toString()
Same as
getDisplayString() . |
public DataSizeFieldValue()
public DataSizeFieldValue(long core)
core
- The long (or integer) field value as it comes from the item.public 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 formatting and language selection.public java.lang.String getDisplayString(java.util.Locale locale, boolean useAllUnits)
locale
- The locale to use for formatting and language selection.useAllUnits
- specifies whether the display string uses only KB as units or can use all available units (for example MB and GB).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 formatting and 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.setFromDisplayString
in interface FieldValue
locale
- The locale to use for formatting and language selection.value
- The display string to set the value from.InvalidArgumentException
- if the display string is not of the right format.public long getCoreValue()
public void setCoreValue(long value)
Item.save()
to save this change back to the catalog.value
- The core value in bytes.public java.lang.String toString()
getDisplayString()
.toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(DataSizeFieldValue other)
compareTo
in interface java.lang.Comparable<DataSizeFieldValue>
other
- the object to be compared.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.