public class DateOnlyFieldValue extends java.lang.Object implements FieldValue, java.lang.Comparable<DateOnlyFieldValue>
Item.getDateOnlyValue(com.canto.cumulus.GUID)
to get this wrapper class object. You can then use Item.setDateOnlyValue(com.canto.cumulus.GUID, DateOnlyFieldValue)
to set the field value back into the item.Constructor and Description |
---|
DateOnlyFieldValue()
Create a new empty date only field value.
|
DateOnlyFieldValue(int coreValue)
Create a new date only field value from the given core field value.
|
Modifier and Type | Method and Description |
---|---|
void |
clearValue()
Clear the field's value.
|
int |
compareTo(DateOnlyFieldValue other)
Compares this object with the specified object for order.
|
boolean |
equals(java.lang.Object o) |
int |
getCoreValue()
Get the core integer value for this date only field value.
|
int |
getDay()
Return the day of month represented by this
DateOnlyFieldValue . |
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.
|
int |
getMonth()
Return the month represented by this
DateOnlyFieldValue . |
java.lang.String |
getUniversalDisplayString()
Returns the content as universal date format.
|
int |
getYear()
Returns the year represented by this
DateOnlyFieldValue . |
int |
getYear(boolean useAstronomicalScale)
Returns the year represented by this
DateOnlyFieldValue . |
int |
hashCode() |
boolean |
hasValue()
Return whether this field has a value.
|
void |
setCoreValue(int coreValue)
Set the value from a core integer value.
|
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.
|
void |
setValue(int day,
int month,
int year)
Set the date only field value from the given day, month, and year.
|
java.lang.String |
toString()
Same as
getDisplayString() . |
public DateOnlyFieldValue()
public DateOnlyFieldValue(int coreValue)
coreValue
- The 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
- Unused parameter.public java.lang.String getUniversalDisplayString()
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 int getYear()
DateOnlyFieldValue
.public int getYear(boolean useAstronomicalScale)
DateOnlyFieldValue
.public int getMonth()
DateOnlyFieldValue
.1
(January) to 12
(December) and is 0
if the value is the whole year.public int getDay()
DateOnlyFieldValue
.1
to 31
and is 0
if the value is the whole month or year.public void setValue(int day, int month, int year)
Item.save()
to save this change back to the catalog.day
- The day of month (1
..31
) to be used. Pass 0
to specify the whole month or year.month
- The month (1
..12
) to be used. Pass 0
to specify the whole year.year
- The year (e.g. 2006
)public int getCoreValue()
public void setCoreValue(int coreValue)
Item.save()
to save this change back to the catalog.coreValue
- The core integer value to be used.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
getDisplayString()
.toString
in class java.lang.Object
public int compareTo(DateOnlyFieldValue other)
compareTo
in interface java.lang.Comparable<DateOnlyFieldValue>
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.