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

pack-priv abstract Class IonValueLite

extends Object
implements _Private_IonValue
Class Inheritance
All Implemented Interfaces
com.amazon.ion.impl._Private_IonValue, com.amazon.ion.IonValue, java.lang.Cloneable
Known Direct Subclasses
com.amazon.ion.impl.lite.IonBoolLite, com.amazon.ion.impl.lite.IonContainerLite, com.amazon.ion.impl.lite.IonDecimalLite, com.amazon.ion.impl.lite.IonFloatLite, com.amazon.ion.impl.lite.IonIntLite, com.amazon.ion.impl.lite.IonLobLite, com.amazon.ion.impl.lite.IonNullLite, com.amazon.ion.impl.lite.IonTextLite, com.amazon.ion.impl.lite.IonTimestampLite
Static Imports
com.amazon.ion.SymbolTable.UNKNOWN_SYMBOL_ID, com.amazon.ion.impl._Private_Utils.EMPTY_STRING_ARRAY, ._Private_Utils.newSymbolToken, com.amazon.ion.util.Equivalence.ionEquals

Base class of the light weight implementation of Ion values.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
pack-priv static class
IonValueLite.LazySymbolTableProvider

Lazy memoized symtab provider.

Field Summary

Modifier and TypeField and Description
protected SymbolToken[]
_annotations

The annotation sequence.

protected IonContext
_context

Not null.

private int
protected String
private int
pack-priv static final int
private static final IonTextWriterBuilder
private static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
IS_LOCKED

this hold all the various boolean flags we have in a single int.

protected static final int
protected static final int
IS_SYMBOL_ID_PRESENT

Symbol ID present refers to there being the possibility that the IonValueLite, or it's contained sub graph (e.g. if it is a IonContainerLite based sub type) contains one or more defined Symbol ID's (SID)'s.

protected static final int
protected static final int
private static final int
private static final int
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
pack-priv
IonValueLite(ContainerlessContext
the context that this value is associated with
context
,
boolean
if true, sets the null bit in the flags member field
isNull
)

The constructor, which is called from the concrete subclasses' constructors.

pack-priv
IonValueLite(IonValueLite
the non-null existing IonValueLite entity to clone
existing
,
IonContext
the non-null parent context to use for the cloned entity.
context
)

Copy Constructor *purely* for cloning - NOTE; this means that the clone is not perfect as if the original entity was read-only the cloned value will now be mutable.

Method Summary

Modifier and TypeMethod and Description
protected final void
_elementid(int elementid)

protected final int
protected final int

Returns:

the metadata from _flags at the given mask.
_getMetadata
(int
the location of the metadata to retrieve.
mask
,
int
the number of bits to right-shift the metadata so that it starts at bit index 0.
shift
)

Used by subclasses to retrieve metadata set by _setMetadata(int, int, int).

protected final boolean
protected final boolean
_isAutoCreated(boolean flag)

protected final boolean
protected final boolean
_isBoolTrue(boolean flag)

protected final boolean
protected final boolean
_isIVM(boolean flag)

protected final boolean
protected final boolean
_isLocked(boolean flag)

protected final boolean
protected final boolean
_isNullValue(boolean flag)

protected final boolean
protected final boolean
_isSymbolIdPresent(boolean flag)

protected final boolean
protected final boolean
_isSymbolPresent(boolean flag)

protected final boolean
protected final boolean
_isSystemValue(boolean flag)

protected final void
_setMetadata(int
the metadata to set.
metadata
,
int
the location at which to set the metadata. Must be within the lower 8 bits.
mask
,
int
the number of bits to left-shift the metadata so that it starts at the index of the mask's LSB.
shift
)

May be used by subclasses to reuse _flag bits for purposes specific to that subclass.

public abstract void
accept(ValueVisitor
will have one of its visit methods called.
visitor
)

Redeclares com.amazon.ion.IonValue.accept.

Entry point for visitor pattern.

public void
addTypeAnnotation(String
as a string value.
annotation
)

Implements com.amazon.ion.IonValue.addTypeAnnotation.

Adds a user type annotation to the annotations attached to this value.

pack-priv boolean

Returns:

true if all SID's have been successfully removed, otherwise false
attemptClearSymbolIDValues
()

Sets this value's symbol table to null, and erases any SIDs here and recursively.

protected void
protected void
pack-priv final void
checkForLock()

Verifies that this value is not read-only.

private final void
clear_flag(int flag_bit)

private boolean
clearSymbolIDsIterative(boolean readOnlyMode)

pack-priv final boolean
public final void
clearTypeAnnotations()

Implements com.amazon.ion.IonValue.clearTypeAnnotations.

Removes all the user type annotations attached to this value.

public abstract IonValue
clone()

Redeclares com.amazon.ion.IonValue.clone.

Overrides java.lang.Object.clone.

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

private int
pack-priv final void
pack-priv final void
detachFromContainer()

Removes this value from its container, ensuring that all data stays available.

public void
public final boolean

Returns:

A boolean, true if the other value is an Ion Value that is the same content and annotations.
equals
(final Object
The value to compare with.
other
)

Overrides java.lang.Object.equals.

Implements com.amazon.ion.IonValue.equals.

Implements equality over values.

public final int
findTypeAnnotation(String
the annotation to find.
annotation
)

Implements com.amazon.ion.impl._Private_IonValue.findTypeAnnotation.

Returns the given annotation's index in the value's annotations list, or -1 if not present.

public SymbolTable
getAssignedSymbolTable()

Implements com.amazon.ion.impl._Private_IonValue.getAssignedSymbolTable.

Returns the symbol table that is directly associated with this value, without doing any recursive lookup.

public IonContainerLite
getContainer()

Implements com.amazon.ion.IonValue.getContainer.

Gets the container of this value, or null if this is not part of one.

pack-priv IonContext

Returns:

this value's context. Not null.
getContext
()

used to query the current context.

public final int
public final int
getFieldId()

Implements com.amazon.ion.IonValue.getFieldId.

Gets the symbol ID of the field name attached to this value.

public final String
getFieldName()

Implements com.amazon.ion.IonValue.getFieldName.

Gets the field name attached to this value, or null if this is not part of an IonStruct.

public final int
public SymbolToken
getFieldNameSymbol()

Implements com.amazon.ion.IonValue.getFieldNameSymbol.

Gets the field name attached to this value as an interned symbol (text + ID).

public final SymbolToken
getFieldNameSymbol(_Private_IonValue.SymbolTableProvider
- provides this IonValue's symbol table
symbolTableProvider
)

Implements com.amazon.ion.impl._Private_IonValue.getFieldNameSymbol.

Overrides IonValue#getFieldNameSymbol() for use when there exists a SymbolTableProvider implementation for this IonValue.

public final SymbolToken
public SymbolTable

Returns:

not null, in conflict with the public documentation.
getSymbolTable
()

Implements com.amazon.ion.IonValue.getSymbolTable.

Gets the symbol table used to encode this value.

public IonSystemLite
getSystem()

Implements com.amazon.ion.IonValue.getSystem.

Gets the system that constructed this value.

public final IonType
getType()

Implements com.amazon.ion.IonValue.getType.

Gets an enumeration value identifying the core Ion data type of this object.

public final String[]
getTypeAnnotations()

Implements com.amazon.ion.IonValue.getTypeAnnotations.

Gets this value's user type annotations as text.

public SymbolToken[]
getTypeAnnotationSymbols()

Implements com.amazon.ion.IonValue.getTypeAnnotationSymbols.

Gets this value's user type annotations as interned symbols (text + ID).

public final SymbolToken[]
getTypeAnnotationSymbols(_Private_IonValue.SymbolTableProvider
- provides this IonValue's symbol table
symbolTableProvider
)

Implements com.amazon.ion.impl._Private_IonValue.getTypeAnnotationSymbols.

Overrides IonValue#getTypeAnnotationSymbols() for use when there exists a SymbolTableProvider implementation for this IonValue.

pack-priv abstract IonType

Returns:

the value's type.
getTypeSlow
()

public int

Returns:

hash code for instance consistent with equals().
hashCode
()

Overrides java.lang.Object.hashCode.

Implements com.amazon.ion.IonValue.hashCode.

Since equals(Object) is overridden, each concrete class representing a scalar value must provide an implementation of scalarHashCode().

pack-priv abstract int

Returns:

the constant hash signature unique to the value's type.
hashSignature
()

protected int
hashTypeAnnotations(final int original)

public final boolean
hasTypeAnnotation(String
as a string value.
annotation
)

Implements com.amazon.ion.IonValue.hasTypeAnnotation.

Determines whether or not the value is annotated with a particular user type annotation.

private final boolean
is_true(int flag_bit)

public final boolean
isNullValue()

Implements com.amazon.ion.IonValue.isNullValue.

Determines whether this in an Ion null value, e.g., null or null.string.

public final boolean
isReadOnly()

Implements com.amazon.ion.IonValue.isReadOnly.

Determines whether this value is read-only.

public void
makeReadOnly()

Implements com.amazon.ion.IonValue.makeReadOnly.

Marks this instance and its children to be immutable.

pack-priv void
public boolean
removeFromContainer()

Implements com.amazon.ion.IonValue.removeFromContainer.

Removes this value from its container, if any.

public void
removeTypeAnnotation(String
as a string value. If null or empty, the method has no effect.
annotation
)

Implements com.amazon.ion.IonValue.removeTypeAnnotation.

Removes a user type annotation from the list of annotations attached to this value.

private boolean
pack-priv abstract int
scalarHashCode()

Internal HashCode implementation to be overridden by scalar subclasses.

private final void
set_flag(int flag_bit)

pack-priv final void
setContext(IonContext
must not be null.
context
)

This method is used to re-set the context of an IonValue.

pack-priv final void
pack-priv final void
setFieldNameSymbol(SymbolToken
is not retained by this value, but both fields are copied.
name
)

Sets the field name and ID based on a SymbolToken.

public void
setSymbolTable(SymbolTable
must be local or system table. May be null.
symbols
)

Implements com.amazon.ion.impl._Private_IonValue.setSymbolTable.

Makes this symbol table current for this value.

public void
setTypeAnnotations(String...
the new annotations. If null or empty array, then all annotations are removed. Any duplicates are preserved.
annotations
)

Implements com.amazon.ion.IonValue.setTypeAnnotations.

Replaces all type annotations with the given text.

public void
setTypeAnnotationSymbols(SymbolToken...
the new annotations. If null or empty array, then all annotations are removed. Any duplicates are preserved.
annotations
)

Implements com.amazon.ion.IonValue.setTypeAnnotationSymbols.

Replaces all type annotations with the given symbol tokens.

pack-priv abstract IonValueLite

Returns:

a shallow clone of this value.
shallowClone
(IonContext
the context applicable to the value's parent.
parentContext
)

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

public IonValueLite
topLevelValue()

Implements com.amazon.ion.IonValue.topLevelValue.

Finds the top level value above this value.

public String
toPrettyString()

Implements com.amazon.ion.IonValue.toPrettyString.

Returns a pretty-printed Ion text representation of this value, using the settings of IonTextWriterBuilder#pretty().

public String
toString()

Overrides java.lang.Object.toString.

Implements com.amazon.ion.IonValue.toString.

Returns a non-canonical Ion-formatted ASCII representation of this value.

public String
toString(IonTextWriterBuilder
the configuration that will be used for writing data to a string.
writerBuilder
)

Implements com.amazon.ion.IonValue.toString.

Returns an Ion text representation of this value, using the settings from the given builder.

public String
pack-priv final void
validateThisNotNull()

Ensures that this value is not an Ion null.

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

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

private static void
public void
writeTo(IonWriter writer)

Implements com.amazon.ion.IonValue.writeTo.

Copies this value to the given IonWriter.

pack-priv final void
private void
Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait