java.io.Serializable
, java.lang.Comparable
, Expression
, Item
, ValueRepresentation
DateTimeValue
, DateValue
, TimeValue
public abstract class CalendarValue extends AtomicValue implements java.lang.Comparable
Modifier and Type | Field | Description |
---|---|---|
static int |
NO_TIMEZONE |
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
EMPTY_CLASS_ARRAY
EMPTY_VALUE_ARRAY
Constructor | Description |
---|---|
CalendarValue() |
Modifier and Type | Method | Description |
---|---|---|
abstract CalendarValue |
add(DurationValue duration) |
Add a duration to this date/time value
|
abstract CalendarValue |
adjustTimezone(int tz) |
Return a new date, time, or dateTime with the same normalized value, but
in a different timezone
|
(package private) static void |
appendString(FastStringBuffer sb,
int value,
int size) |
Append an integer, formatted with leading zeros to a fixed size, to a string buffer
|
static void |
appendTimezone(int tz,
FastStringBuffer sb) |
|
void |
appendTimezone(FastStringBuffer sb) |
Add a string representation of the timezone, typically
formatted as "Z" or "+03:00" or "-10:00", to a supplied
string buffer
|
(package private) static void |
appendTwoDigits(FastStringBuffer sb,
int value) |
Append an integer, formatted as two digits, to a string buffer
|
abstract int |
compareTo(CalendarValue other,
Configuration config) |
Compare this value to another value of the same type, using the supplied ConversionContext
to get the implicit timezone if required.
|
abstract CalendarValue |
copy() |
Make a copy of this date, time, or dateTime value
|
abstract java.util.GregorianCalendar |
getCalendar() |
Get a Java Calendar object that represents this date/time value.
|
abstract ComparisonKey |
getComparisonKey(Configuration config) |
Get a comparison key for this value.
|
java.lang.String |
getStringValue() |
Convert the value to a string
|
int |
getTimezoneInMinutes() |
Get the timezone value held in this object.
|
boolean |
hasTimezone() |
Determine whether this value includes a timezone
|
CalendarValue |
removeTimezone() |
Return a date, time, or dateTime with the same localized value, but
without the timezone component
|
void |
setTimezoneInMinutes(int minutes) |
Modify the timezone value held in this object.
|
SecondsDurationValue |
subtract(CalendarValue other,
XPathContext context) |
Determine the difference between two points in time, as a duration
|
abstract DateTimeValue |
toDateTime() |
Convert the value to a DateTime, retaining all the components that are actually present, and
substituting conventional values for components that are missing
|
checkPermittedContents, convert, convert, convertPrimitive, display, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getComponent, getImplementationMethod, getLength, getPrimitiveValue, getStringValueCS, getTypedValue, hasBuiltInType, iterate, process, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asItem, asIterator, asValue, convert, convertJavaObjectToXPath, convertToJava, equals, getDependencies, getItemType, getIterator, getParentExpression, getSpecialProperties, hashCode, itemAt, iterateSubExpressions, makeQNameValue, optimize, promote, reduce, simplify, stringToNumber, typeCheck
public static final int NO_TIMEZONE
public final boolean hasTimezone()
public final void setTimezoneInMinutes(int minutes)
minutes
- The timezone offset from GMT in minutes, positive or negative; or the special
value NO_TIMEZONE indicating that the value is not in a timezone (this is the default if this
method is not called)public abstract DateTimeValue toDateTime()
public final int getTimezoneInMinutes()
public final java.lang.String getStringValue()
getStringValue
in interface Item
getStringValue
in interface ValueRepresentation
getStringValue
in class AtomicValue
Item.getStringValueCS()
public abstract java.util.GregorianCalendar getCalendar()
public abstract CalendarValue add(DurationValue duration) throws XPathException
duration
- the duration to be added (which might be negative)XPathException
public SecondsDurationValue subtract(CalendarValue other, XPathContext context) throws XPathException
other
- the other point in timecontext
- the dynamic context, used to obtain timezone information. May be set to null
only if both values contain an explicit timezone, or if neither does so.XPathException
- for example if one value is a date and the other is a timepublic final CalendarValue removeTimezone()
public abstract CalendarValue adjustTimezone(int tz)
tz
- the new timezone, in minutespublic abstract CalendarValue copy()
public abstract int compareTo(CalendarValue other, Configuration config)
public abstract ComparisonKey getComparisonKey(Configuration config)
public final void appendTimezone(FastStringBuffer sb)
sb
- The StringBuffer that will be updated with the resulting string
representationpublic static final void appendTimezone(int tz, FastStringBuffer sb)
static void appendString(FastStringBuffer sb, int value, int size)
sb
- the string buffervalue
- the integer to be formattedsize
- the number of digits required (max 9)static void appendTwoDigits(FastStringBuffer sb, int value)
sb
- the string buffervalue
- the integer to be formatted (must be in the range 0..99