Package com.tangosol.io.pof
Class RawTime
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.io.pof.PofHelper
-
- com.tangosol.io.pof.RawTime
-
- All Implemented Interfaces:
PofConstants
public class RawTime extends PofHelper
An immutable POF time value.- Since:
- Coherence 3.2
- Author:
- cp 2006.07.17
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.io.pof.PofHelper
PofHelper.ReadableEntrySetMap, PofHelper.WriteableEntrySetMap
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Field Summary
-
Fields inherited from class com.tangosol.io.pof.PofHelper
BIGDECIMAL_ZERO, BIGINTEGER_MAX_LONG, BIGINTEGER_MIN_LONG, BINARY_EMPTY, BOOLEAN_ARRAY_EMPTY, BYTE_ARRAY_EMPTY, CHAR_ARRAY_EMPTY, COLLECTION_EMPTY, DOUBLE_ARRAY_EMPTY, FLOAT_ARRAY_EMPTY, INT_ARRAY_EMPTY, LONG_ARRAY_EMPTY, OBJECT_ARRAY_EMPTY, SHORT_ARRAY_EMPTY
-
Fields inherited from class com.tangosol.util.Base
LOG_ALWAYS, LOG_CONFIG, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_US
-
Fields inherited from interface com.tangosol.io.pof.PofConstants
J_BIG_DECIMAL, J_BIG_INTEGER, J_BINARY, J_BOOLEAN, J_BOOLEAN_ARRAY, J_BYTE, J_BYTE_ARRAY, J_CHAR_ARRAY, J_CHARACTER, J_COLLECTION, J_DATE, J_DATETIME, J_DOUBLE, J_DOUBLE_ARRAY, J_FLOAT, J_FLOAT_ARRAY, J_INT_ARRAY, J_INTEGER, J_LOCAL_DATE, J_LOCAL_DATETIME, J_LOCAL_TIME, J_LONG, J_LONG_ARRAY, J_MAP, J_NULL, J_OBJECT_ARRAY, J_OFFSET_DATETIME, J_OFFSET_TIME, J_QUAD, J_RAW_DATE, J_RAW_DATETIME, J_RAW_DAY_TIME_INTERVAL, J_RAW_TIME, J_RAW_TIME_INTERVAL, J_RAW_YEAR_MONTH_INTERVAL, J_SHORT, J_SHORT_ARRAY, J_SPARSE_ARRAY, J_STRING, J_TIME, J_TIMESTAMP, J_USER_TYPE, J_ZONED_DATETIME, MAX_DECIMAL128_SCALE, MAX_DECIMAL128_UNSCALED, MAX_DECIMAL32_SCALE, MAX_DECIMAL32_UNSCALED, MAX_DECIMAL64_SCALE, MAX_DECIMAL64_UNSCALED, MIN_DECIMAL128_SCALE, MIN_DECIMAL32_SCALE, MIN_DECIMAL64_SCALE, T_ARRAY, T_BOOLEAN, T_CHAR, T_CHAR_STRING, T_COLLECTION, T_DATE, T_DATETIME, T_DAY_TIME_INTERVAL, T_DECIMAL128, T_DECIMAL32, T_DECIMAL64, T_FLOAT128, T_FLOAT32, T_FLOAT64, T_IDENTITY, T_INT128, T_INT16, T_INT32, T_INT64, T_MAP, T_OCTET, T_OCTET_STRING, T_REFERENCE, T_SPARSE_ARRAY, T_TIME, T_TIME_INTERVAL, T_UNIFORM_ARRAY, T_UNIFORM_COLLECTION, T_UNIFORM_KEYS_MAP, T_UNIFORM_MAP, T_UNIFORM_SPARSE_ARRAY, T_UNKNOWN, T_YEAR_MONTH_INTERVAL, V_BOOLEAN_FALSE, V_BOOLEAN_TRUE, V_COLLECTION_EMPTY, V_FP_NAN, V_FP_NEG_INFINITY, V_FP_POS_INFINITY, V_INT_0, V_INT_1, V_INT_10, V_INT_11, V_INT_12, V_INT_13, V_INT_14, V_INT_15, V_INT_16, V_INT_17, V_INT_18, V_INT_19, V_INT_2, V_INT_20, V_INT_21, V_INT_22, V_INT_3, V_INT_4, V_INT_5, V_INT_6, V_INT_7, V_INT_8, V_INT_9, V_INT_NEG_1, V_REFERENCE_NULL, V_STRING_ZERO_LENGTH
-
-
Constructor Summary
Constructors Constructor Description RawTime(int nHour, int nMinute, int nSecond, int nNano, boolean fUTC)
Construct a raw POF time value.RawTime(int nHour, int nMinute, int nSecond, int nNano, int nHourOffset, int nMinuteOffset)
Construct a raw POF time value with a timezone.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Compare this object with another for equality.static RawTime
from(Object o)
Create RawTime from the specified object.static RawTime
from(Time time)
Create a RawTime from the JDBC Time.static RawTime
from(LocalTime time)
Create RawTime from LocalTime.static RawTime
from(OffsetTime time)
Create RawTime from OffsetTime.static RawTime
from(Date date)
Create a RawTime from the Java Date.int
getHour()
Determine the time's hour value.int
getHourOffset()
Determine the timezone's hour offset value.int
getMinute()
Determine the time's minute value.int
getMinuteOffset()
Determine the timezone's minute offset value.int
getNano()
Determine the time's nanosecond value.int
getSecond()
Determine the time's second value.int
hashCode()
Obtain the hashcode for this object.boolean
hasTimezone()
Determine if the time value has an explicit timezone.boolean
isUTC()
Determine if the time value uses UTC.Date
toJavaDate()
Create a Java Date from the raw time information.LocalTime
toLocalTime()
Create a LocalTime from the raw time information.OffsetTime
toOffsetTime()
Create a OffsetTime from the raw time information.Time
toSqlTime()
Create a JDBC Time from the raw time information.String
toString()
Format this object's data as a human-readable string.-
Methods inherited from class com.tangosol.io.pof.PofHelper
calcDecimalSize, checkDate, checkDayTimeInterval, checkDecimalRange, checkElementCount, checkReferenceRange, checkTime, checkTimeInterval, checkTimeZone, checkType, checkYearMonthInterval, convertNumber, convertToDate, decodeTinyInt, encodeTinyInt, formatDate, formatTime, formatTime, getJavaTypeId, getPofTypeId, isIntrinsicPofType, readAsBigDecimal, readAsBigInteger, readAsChar, readAsDouble, readAsFloat, readAsInt, readAsLong, readAsQuad, readBigDecimal, readBigInteger, readChar, readLocalDate, readLocalDateTime, readLocalTime, readOffsetDateTime, readOffsetTime, readQuad, readRawDate, readRawTime, resizeArray, skipPackedInts, skipUniformValue, skipValue, writeBigDecimal, writeBigInteger, writeDate, writeTime
-
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
-
-
-
Constructor Detail
-
RawTime
public RawTime(int nHour, int nMinute, int nSecond, int nNano, boolean fUTC)
Construct a raw POF time value.- Parameters:
nHour
- the hour between 0 and 23 inclusivenMinute
- the minute value between 0 and 59 inclusivenSecond
- the second value between 0 and 59 inclusive (and theoretically 60 for a leap-second)nNano
- the nanosecond value between 0 and 999999999 inclusivefUTC
- true if the time value is UTC or false if the time value does not have an explicit time zone
-
RawTime
public RawTime(int nHour, int nMinute, int nSecond, int nNano, int nHourOffset, int nMinuteOffset)
Construct a raw POF time value with a timezone.- Parameters:
nHour
- the hour between 0 and 23 inclusivenMinute
- the minute value between 0 and 59 inclusivenSecond
- the second value between 0 and 59 inclusive (and theoretically 60 for a leap-second)nNano
- the nanosecond value between 0 and 999999999 inclusivenHourOffset
- the timezone offset in hours from UTC, for example 0 for BST, -5 for EST and 1 for CETnMinuteOffset
- the timezone offset in minutes, for example 0 (in most cases) or 30
-
-
Method Detail
-
getHour
public int getHour()
Determine the time's hour value.- Returns:
- the hour between 0 and 23 inclusive
-
getMinute
public int getMinute()
Determine the time's minute value.- Returns:
- the minute value between 0 and 59 inclusive
-
getSecond
public int getSecond()
Determine the time's second value.- Returns:
- the second value between 0 and 59 inclusive (and possibly 60 for a leap-second)
-
getNano
public int getNano()
Determine the time's nanosecond value.- Returns:
- the nanosecond value between 0 and 999999999 inclusive
-
hasTimezone
public boolean hasTimezone()
Determine if the time value has an explicit timezone. A time value without an explicit timezone is assumed to be in some conventional local timezone, according to ISO8601.- Returns:
- true iff the time has an explicit timezone
-
isUTC
public boolean isUTC()
Determine if the time value uses UTC.- Returns:
- true if the time value is a UTC value
-
getHourOffset
public int getHourOffset()
Determine the timezone's hour offset value.- Returns:
- the hour offset of the timezeone, or zero if there is no explicit timezone or the time is UTC
-
getMinuteOffset
public int getMinuteOffset()
Determine the timezone's minute offset value.- Returns:
- the minute offset of the timezeone, or zero if there is no explicit timezone or the time is UTC
-
from
public static RawTime from(Object o)
Create RawTime from the specified object.- Parameters:
o
- an object to create RawTime from.- Returns:
- a RawTime value
- Throws:
IllegalArgumentException
- if the specified object cannot be converted to RawTime
-
from
public static RawTime from(LocalTime time)
Create RawTime from LocalTime.- Parameters:
time
- time to create raw time from- Returns:
- a RawTime value
-
from
public static RawTime from(OffsetTime time)
Create RawTime from OffsetTime.- Parameters:
time
- time to create raw time from- Returns:
- a RawTime value
-
from
public static RawTime from(Time time)
Create a RawTime from the JDBC Time.- Parameters:
time
- a Time value- Returns:
- a RawTime value
-
from
public static RawTime from(Date date)
Create a RawTime from the Java Date.- Parameters:
date
- a Date value- Returns:
- a RawTime value
-
toLocalTime
public LocalTime toLocalTime()
Create a LocalTime from the raw time information.- Returns:
- a LocalTime value
-
toOffsetTime
public OffsetTime toOffsetTime()
Create a OffsetTime from the raw time information.- Returns:
- a OffsetTime value
- Throws:
IllegalStateException
- if this RawTime does not have time zone information
-
toSqlTime
public Time toSqlTime()
Create a JDBC Time from the raw time information. Note that the JDBC Time does not include second, nano or timezone information.- Returns:
- a JDBC Time value
-
toJavaDate
public Date toJavaDate()
Create a Java Date from the raw time information.- Returns:
- a Java Date value
-
equals
public boolean equals(Object o)
Compare this object with another for equality.
-
hashCode
public int hashCode()
Obtain the hashcode for this object.
-
-