Top Fields Constructors Methods
com.amazon.ion.impl.lite

pack-priv final Class IonTimestampLite

extends IonValueLite
implements IonTimestamp
Class Inheritance
All Implemented Interfaces
com.amazon.ion.IonTimestamp, com.amazon.ion.IonValue, java.lang.Cloneable
Imports
com.amazon.ion.IonTimestamp, .IonType, .IonWriter, .NullValueException, .Timestamp, .ValueVisitor, java.io.IOException, java.math.BigDecimal, java.util.Date

Field Summary

Modifier and TypeField and Description
private Timestamp
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
public static final Integer
Inherited from com.amazon.ion.impl.lite.IonValueLite:
_annotations_context_fieldNameCONTAINER_STACK_INITIAL_CAPACITYELEMENT_SHIFTIS_AUTO_CREATEDIS_BOOL_TRUEIS_IVMIS_LOCKEDIS_NULL_VALUEIS_SYMBOL_ID_PRESENTIS_SYMBOL_PRESENTIS_SYSTEM_VALUE

Constructor Summary

AccessConstructor and Description
pack-priv
IonTimestampLite(ContainerlessContext context, boolean isNull)

Constructs a null.timestamp value.

pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
accept(ValueVisitor
will have one of its visit methods called.
visitor
)

Implements abstract com.amazon.ion.impl.lite.IonValueLite.accept.

Implements com.amazon.ion.IonValue.accept.

Entry point for visitor pattern.

public IonTimestampLite
clone()

Implements abstract com.amazon.ion.impl.lite.IonValueLite.clone.

Implements com.amazon.ion.IonTimestamp.clone, com.amazon.ion.IonValue.clone.

Creates a copy of this value and all of its children.

public Date
dateValue()

Implements com.amazon.ion.IonTimestamp.dateValue.

Gets the value of this Ion timestamp as a Java Date, representing the time in UTC.

public BigDecimal
getDecimalMillis()

Implements com.amazon.ion.IonTimestamp.getDecimalMillis.

Gets the value of this Ion timestamp as the number of milliseconds since 1970-01-01T00:00:00Z, including fractional milliseconds.

private Integer
getInternalLocalOffset()

Returns null if this is null.timestamp.

public Integer
getLocalOffset()

Implements com.amazon.ion.IonTimestamp.getLocalOffset.

Gets the local offset (in minutes) of this timestamp, or null if it's unknown (i.e., -00:00).

public long
getMillis()

Implements com.amazon.ion.IonTimestamp.getMillis.

Gets the value of this Ion timestamp as the number of milliseconds since 1970-01-01T00:00:00.000Z, truncating any fractional milliseconds.

public IonType
pack-priv int
public void
makeNull()

Implements com.amazon.ion.IonTimestamp.makeNull.

Sets this timestamp to Ion null.timestamp.

pack-priv int
scalarHashCode()

Implements abstract com.amazon.ion.impl.lite.IonValueLite.scalarHashCode.

Internal HashCode implementation to be overridden by scalar subclasses.

public void
setCurrentTime()

Implements com.amazon.ion.IonTimestamp.setCurrentTime.

Sets the time portion of this timestamp to the current time, leaving the local offset portion unchanged.

public void
setCurrentTimeUtc()

Implements com.amazon.ion.IonTimestamp.setCurrentTimeUtc.

Sets the time portion of this timestamp to the current time, and the local offset portion to UTC.

public void
setDecimalMillis(BigDecimal
the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.
millis
)

Implements com.amazon.ion.IonTimestamp.setDecimalMillis.

Sets this timestamp to represent the point in time that is millis milliseconds after 1970-01-01T00:00:00Z, with the same local offset part.

public void
setLocalOffset(int
is the new local offset, in minutes. Zero indicates UTC.
minutes
)

Implements com.amazon.ion.IonTimestamp.setLocalOffset.

Sets the local-offset portion of this timestamp.

public void
setLocalOffset(Integer
is the new local offset, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).
minutes
)

Implements com.amazon.ion.IonTimestamp.setLocalOffset.

Sets the local-offset portion of this timestamp.

public void
setMillis(long
the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.
millis
)

Implements com.amazon.ion.IonTimestamp.setMillis.

Sets this timestamp to represent the point in time that is millis milliseconds after 1970-01-01T00:00:00Z, with the same local offset part.

public void
setMillisUtc(long
the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.
millis
)

Implements com.amazon.ion.IonTimestamp.setMillisUtc.

Sets this timestamp to represent the point in time that is millis milliseconds after 1970-01-01T00:00:00Z, and sets the local offset to UTC.

public void
setTime(Date
will be copied into this element. If null then this becomes null.timestamp.
value
)

Implements com.amazon.ion.IonTimestamp.setTime.

Sets the time portion of this timestamp.

public void
setValue(Timestamp
may be null to cause this to be null.timestamp.
timestamp
)

Implements com.amazon.ion.IonTimestamp.setValue.

Sets the value of this timestamp.

public void
setValue(BigDecimal
the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.
millis
,
Integer
the local offset of this timestamp, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).
localOffset
)

Implements com.amazon.ion.IonTimestamp.setValue.

Sets this timestamp to represent the point in time that is millis milliseconds after 1970-01-01T00:00:00Z, with the specified local offset of localOffset.

public void
setValue(long
the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.
millis
,
Integer
the local offset of this timestamp, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).
localOffset
)

Implements com.amazon.ion.IonTimestamp.setValue.

Sets this timestamp to represent the point in time that is millis milliseconds after 1970-01-01T00:00:00Z, with the specified local offset of localOffset.

pack-priv IonValueLite
shallowClone(IonContext
the context applicable to the value's parent.
context
)

Implements abstract com.amazon.ion.impl.lite.IonValueLite.shallowClone.

Clones the value's annotations and field name (if any).

public Timestamp
timestampValue()

Implements com.amazon.ion.IonTimestamp.timestampValue.

Gets the value of this timestamp in a form suitable for use independent of Ion data.

pack-priv final void
writeBodyTo(IonWriter
an IonWriter.
writer
,
_Private_IonValue.SymbolTableProvider
a SymbolTableProvider.
symbolTableProvider
)

Implements abstract com.amazon.ion.impl.lite.IonValueLite.writeBodyTo.

Writes a *non-null scalar* value to the given writer.

Inherited from com.amazon.ion.impl.lite.IonValueLite:
_elementid_elementid_getMetadata_isAutoCreated_isAutoCreated_isBoolTrue_isBoolTrue_isIVM_isIVM_isLocked_isLocked_isNullValue_isNullValue_isSymbolIdPresent_isSymbolIdPresent_isSymbolPresent_isSymbolPresent_isSystemValue_isSystemValue_setMetadataaddTypeAnnotationattemptClearSymbolIDValuescascadeSIDPresentToContextRootcheckAnnotationsForSidscheckForLockclearSymbolIDValuesclearTypeAnnotationscopyFieldNamedetachFromContainerdumpequalsfindTypeAnnotationgetAssignedSymbolTablegetContainergetContextgetElementIdgetFieldIdgetFieldNamegetFieldNameIdgetFieldNameSymbolgetFieldNameSymbolgetKnownFieldNameSymbolgetSymbolTablegetSystemgetTypegetTypeAnnotationsgetTypeAnnotationSymbolsgetTypeAnnotationSymbolshashCodehashTypeAnnotationshasTypeAnnotationisNullValueisReadOnlymakeReadOnlymakeReadOnlyInternalremoveFromContainerremoveTypeAnnotationsetContextsetFieldNamesetFieldNameSymbolsetSymbolTablesetTypeAnnotationssetTypeAnnotationSymbolstopLevelValuetoPrettyStringtoStringtoStringvalidatevalidateThisNotNullwriteTowriteTo

Field Detail

_timestamp_valueback to summary
private Timestamp _timestamp_value
BIT_FLAG_DAYback to summary
private static final int BIT_FLAG_DAY
BIT_FLAG_FRACTIONback to summary
private static final int BIT_FLAG_FRACTION
BIT_FLAG_MINUTEback to summary
private static final int BIT_FLAG_MINUTE
BIT_FLAG_MONTHback to summary
private static final int BIT_FLAG_MONTH
BIT_FLAG_SECONDback to summary
private static final int BIT_FLAG_SECOND
BIT_FLAG_YEARback to summary
private static final int BIT_FLAG_YEAR
HASH_SIGNATUREback to summary
private static final int HASH_SIGNATURE
UTC_OFFSETback to summary
public static final Integer UTC_OFFSET

Constructor Detail

IonTimestampLiteback to summary
pack-priv IonTimestampLite(ContainerlessContext context, boolean isNull)

Constructs a null.timestamp value.

IonTimestampLiteback to summary
pack-priv IonTimestampLite(IonTimestampLite existing, IonContext context)

Method Detail

acceptback to summary
public void accept(ValueVisitor visitor) throws Exception

Implements abstract com.amazon.ion.impl.lite.IonValueLite.accept.

Implements com.amazon.ion.IonValue.accept.

Doc from com.amazon.ion.IonValue.accept.

Entry point for visitor pattern. Implementations of this method by concrete classes will simply call the appropriate visit method on the visitor. For example, instances of IonBool will invoke ValueVisitor#visit(IonBool).

Parameters
visitor:ValueVisitor

will have one of its visit methods called.

Annotations
@Override
Exceptions
Exception:
any exception thrown by the visitor is propagated.
cloneback to summary
public IonTimestampLite clone()

Implements abstract com.amazon.ion.impl.lite.IonValueLite.clone.

Implements com.amazon.ion.IonTimestamp.clone, com.amazon.ion.IonValue.clone.

Doc from com.amazon.ion.IonValue.clone.

Creates a copy of this value and all of its children. The cloned value may use the same shared symbol tables, but it will have an independent local symbol table if necessary. The cloned value will be modifiable regardless of whether this instance isReadOnly().

The cloned value will be created in the context of the same ValueFactory as this instance; if you want a copy using a different factory, then use ValueFactory#clone(IonValue) instead.

Returns:IonTimestampLite

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
dateValueback to summary
public Date dateValue()

Implements com.amazon.ion.IonTimestamp.dateValue.

Doc from com.amazon.ion.IonTimestamp.dateValue.

Gets the value of this Ion timestamp as a Java Date, representing the time in UTC. As a result, this method will return the same result for all Ion representations of the same instant, regardless of the local offset.

Because Date instances are mutable, this method returns a new instance from each call.

Returns:Date

a new Date value, in UTC, or null if this.isNullValue().

getDecimalMillisback to summary
public BigDecimal getDecimalMillis()

Implements com.amazon.ion.IonTimestamp.getDecimalMillis.

Doc from com.amazon.ion.IonTimestamp.getDecimalMillis.

Gets the value of this Ion timestamp as the number of milliseconds since 1970-01-01T00:00:00Z, including fractional milliseconds. This method will return the same result for all Ion representations of the same instant, regardless of the local offset.

Returns:BigDecimal

the number of milliseconds since 1970-01-01T00:00:00Z represented by this timestamp, or null if this.isNullValue().

getInternalLocalOffsetback to summary
private Integer getInternalLocalOffset()

Returns null if this is null.timestamp.

getLocalOffsetback to summary
public Integer getLocalOffset() throws NullValueException

Implements com.amazon.ion.IonTimestamp.getLocalOffset.

Doc from com.amazon.ion.IonTimestamp.getLocalOffset.

Gets the local offset (in minutes) of this timestamp, or null if it's unknown (i.e., -00:00).

For example, the result for 1969-02-23T07:00+07:00 is 420, the result for 1969-02-22T22:45:00.00-01:15 is -75, and the result for 1969-02-23 (by Ion's definition, equivalent to 1969-02-23T00:00-00:00) is null.

Returns:Integer

the positive or negative local-time offset, represented as minutes from UTC. If the offset is unknown, returns null.

Exceptions
NullValueException:
if this.isNullValue().
getMillisback to summary
public long getMillis()

Implements com.amazon.ion.IonTimestamp.getMillis.

Doc from com.amazon.ion.IonTimestamp.getMillis.

Gets the value of this Ion timestamp as the number of milliseconds since 1970-01-01T00:00:00.000Z, truncating any fractional milliseconds. This method will return the same result for all Ion representations of the same instant, regardless of the local offset.

Returns:long

the number of milliseconds since 1970-01-01T00:00:00.000Z represented by this timestamp.

getTypeSlowback to summary
public IonType getTypeSlow()

Implements abstract com.amazon.ion.impl.lite.IonValueLite.getTypeSlow.

Returns:IonType

Doc from com.amazon.ion.impl.lite.IonValueLite.getTypeSlow.

the value's type.

Annotations
@Override
hashSignatureback to summary
pack-priv int hashSignature()

Implements abstract com.amazon.ion.impl.lite.IonValueLite.hashSignature.

Returns:int

Doc from com.amazon.ion.impl.lite.IonValueLite.hashSignature.

the constant hash signature unique to the value's type.

Annotations
@Override
makeNullback to summary
public void makeNull()

Implements com.amazon.ion.IonTimestamp.makeNull.

Doc from com.amazon.ion.IonTimestamp.makeNull.

Sets this timestamp to Ion null.timestamp.

scalarHashCodeback to summary
pack-priv int scalarHashCode()

Implements abstract com.amazon.ion.impl.lite.IonValueLite.scalarHashCode.

Doc from com.amazon.ion.impl.lite.IonValueLite.scalarHashCode.

Internal HashCode implementation to be overridden by scalar subclasses. Must only be called on non-null values.

Annotations
@Override
setCurrentTimeback to summary
public void setCurrentTime()

Implements com.amazon.ion.IonTimestamp.setCurrentTime.

Doc from com.amazon.ion.IonTimestamp.setCurrentTime.

Sets the time portion of this timestamp to the current time, leaving the local offset portion unchanged.

If this.isNullValue(), then the local offset will be unknown.

setCurrentTimeUtcback to summary
public void setCurrentTimeUtc()

Implements com.amazon.ion.IonTimestamp.setCurrentTimeUtc.

Doc from com.amazon.ion.IonTimestamp.setCurrentTimeUtc.

Sets the time portion of this timestamp to the current time, and the local offset portion to UTC.

setDecimalMillisback to summary
public void setDecimalMillis(BigDecimal millis)

Implements com.amazon.ion.IonTimestamp.setDecimalMillis.

Doc from com.amazon.ion.IonTimestamp.setDecimalMillis.

Sets this timestamp to represent the point in time that is millis milliseconds after 1970-01-01T00:00:00Z, with the same local offset part.

If this is null.timestamp, then the local offset will be unknown.

Parameters
millis:BigDecimal

the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.

setLocalOffsetback to summary
public void setLocalOffset(int minutes) throws NullValueException

Implements com.amazon.ion.IonTimestamp.setLocalOffset.

Doc from com.amazon.ion.IonTimestamp.setLocalOffset.

Sets the local-offset portion of this timestamp. The time portion is not changed. Note that this method cannot set the unknown offset (-00:00); to do that use setLocalOffset(Integer).

Parameters
minutes:int

is the new local offset, in minutes. Zero indicates UTC.

Exceptions
NullValueException:
if this.isNullValue().
setLocalOffsetback to summary
public void setLocalOffset(Integer minutes) throws NullValueException

Implements com.amazon.ion.IonTimestamp.setLocalOffset.

Doc from com.amazon.ion.IonTimestamp.setLocalOffset.

Sets the local-offset portion of this timestamp. The time portion is not changed.

Parameters
minutes:Integer

is the new local offset, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).

Exceptions
NullValueException:
if this.isNullValue().
setMillisback to summary
public void setMillis(long millis)

Implements com.amazon.ion.IonTimestamp.setMillis.

Doc from com.amazon.ion.IonTimestamp.setMillis.

Sets this timestamp to represent the point in time that is millis milliseconds after 1970-01-01T00:00:00Z, with the same local offset part.

If this is null.timestamp, then the local offset will be unknown.

Parameters
millis:long

the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.

setMillisUtcback to summary
public void setMillisUtc(long millis)

Implements com.amazon.ion.IonTimestamp.setMillisUtc.

Doc from com.amazon.ion.IonTimestamp.setMillisUtc.

Sets this timestamp to represent the point in time that is millis milliseconds after 1970-01-01T00:00:00Z, and sets the local offset to UTC.

Parameters
millis:long

the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.

setTimeback to summary
public void setTime(Date value)

Implements com.amazon.ion.IonTimestamp.setTime.

Doc from com.amazon.ion.IonTimestamp.setTime.

Sets the time portion of this timestamp. If value is null, then this will become null.timestamp. If this is null.timestamp, then the local offset will be unknown.

Parameters
value:Date

will be copied into this element. If null then this becomes null.timestamp.

setValueback to summary
public void setValue(Timestamp timestamp)

Implements com.amazon.ion.IonTimestamp.setValue.

Doc from com.amazon.ion.IonTimestamp.setValue.

Sets the value of this timestamp.

Parameters
timestamp:Timestamp

may be null to cause this to be null.timestamp.

setValueback to summary
public void setValue(BigDecimal millis, Integer localOffset)

Implements com.amazon.ion.IonTimestamp.setValue.

Doc from com.amazon.ion.IonTimestamp.setValue.

Sets this timestamp to represent the point in time that is millis milliseconds after 1970-01-01T00:00:00Z, with the specified local offset of localOffset.

Parameters
millis:BigDecimal

the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.

localOffset:Integer

the local offset of this timestamp, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).

setValueback to summary
public void setValue(long millis, Integer localOffset)

Implements com.amazon.ion.IonTimestamp.setValue.

Doc from com.amazon.ion.IonTimestamp.setValue.

Sets this timestamp to represent the point in time that is millis milliseconds after 1970-01-01T00:00:00Z, with the specified local offset of localOffset.

Parameters
millis:long

the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.

localOffset:Integer

the local offset of this timestamp, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).

shallowCloneback to summary
pack-priv IonValueLite shallowClone(IonContext context)

Implements abstract com.amazon.ion.impl.lite.IonValueLite.shallowClone.

Doc from com.amazon.ion.impl.lite.IonValueLite.shallowClone.

Clones the value's annotations and field name (if any). For scalars, also clones the value. For containers, leaves the cloned container empty rather than cloning the children.

Parameters
context:IonContext

the context applicable to the value's parent.

Returns:IonValueLite

a shallow clone of this value.

Annotations
@Override
timestampValueback to summary
public Timestamp timestampValue()

Implements com.amazon.ion.IonTimestamp.timestampValue.

Doc from com.amazon.ion.IonTimestamp.timestampValue.

Gets the value of this timestamp in a form suitable for use independent of Ion data.

Returns:Timestamp

the value of this timestamp, or null if this.isNullValue().

writeBodyToback to summary
pack-priv final void writeBodyTo(IonWriter writer, _Private_IonValue.SymbolTableProvider symbolTableProvider) throws IOException

Implements abstract com.amazon.ion.impl.lite.IonValueLite.writeBodyTo.

Doc from com.amazon.ion.impl.lite.IonValueLite.writeBodyTo.

Writes a *non-null scalar* value to the given writer. It is incorrect to call this method on a container value.

Parameters
writer:IonWriter

an IonWriter.

symbolTableProvider:_Private_IonValue.SymbolTableProvider

a SymbolTableProvider.

Annotations
@Override
Exceptions
IOException:
if thrown when writing the value.