Top Description Fields Methods
com.amazon.ion

public Interface IonContainer

extends IonValue, Iterable<IonValue>
Known Direct Subinterfaces
com.amazon.ion.IonSequence, com.amazon.ion.IonStruct, com.amazon.ion.impl._Private_IonContainer
Imports
java.util.Collection, .Iterator

Common functionality of Ion struct, list, and sexp types.

Warning

This interface should not be implemented or extended by code outside of this library.

Field Summary

Inherited from com.amazon.ion.IonValue:
EMPTY_ARRAY

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Clears the contents of this container (if any) and set it to empty.

public IonContainer
clone()

Redeclares com.amazon.ion.IonValue.clone.

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

public boolean

Returns:

true if this container has no contents
isEmpty
()

Checks if this container is empty.

public Iterator<IonValue>

Returns:

a new iterator, not null.
iterator
()

Redeclares java.lang.Iterable.iterator.

Creates an iterator providing the (direct) elements of this container.

public void
makeNull()

Sets the contents of this container to an Ion null value.

public boolean

Returns:

true if this container contained the specified element.
remove
(IonValue
the element to be removed from this container, if present.
element
)

Removes the given element from this container.

public int

Returns:

the number of elements, zero if this.isNullValue().
size
()

Returns the number of elements in this container.

Inherited from com.amazon.ion.IonValue:
acceptaddTypeAnnotationclearTypeAnnotationsequalsgetContainergetFieldIdgetFieldNamegetFieldNameSymbolgetSymbolTablegetSystemgetTypegetTypeAnnotationsgetTypeAnnotationSymbolshashCodehasTypeAnnotationisNullValueisReadOnlymakeReadOnlyremoveFromContainerremoveTypeAnnotationsetTypeAnnotationssetTypeAnnotationSymbolstopLevelValuetoPrettyStringtoStringtoStringwriteTo
Inherited from java.lang.Iterable:
forEachspliterator

Method Detail

clearback to summary
public void clear()

Clears the contents of this container (if any) and set it to empty. If this container is an Ion null value, set it to empty.

Use makeNull to make this container null rather than empty.

Warning

This method is not support for instances of IonDatagram.

cloneback to summary
public IonContainer clone() throws UnknownSymbolException

Redeclares 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.

Exceptions
UnknownSymbolException:
if any part of this value has unknown text but known Sid for its field name, annotation or symbol.
isEmptyback to summary
public boolean isEmpty() throws NullValueException

Checks if this container is empty.

Returns:boolean

true if this container has no contents

Exceptions
NullValueException:
if this container is an Ion null value
iteratorback to summary
public Iterator<IonValue> iterator()

Redeclares java.lang.Iterable.iterator.

Creates an iterator providing the (direct) elements of this container. If this is an Ion null value, then this method returns an empty iterator.

Note that iteration over a IonStruct has unspecified ordering, while iteration over an IonSequence (IonList or IonSexp) must return elements in order of their appearance in the Ion representation.

Returns:Iterator<IonValue>

a new iterator, not null.

makeNullback to summary
public void makeNull()

Sets the contents of this container to an Ion null value.

Use clear to make this container empty rather than null.

removeback to summary
public boolean remove(IonValue element)

Removes the given element from this container. If this is an Ion null value, then this method returns false.

Note that, unlike Collection#remove(Object), this method uses object identity, not Object#equals(Object), to find the element. That is, the given instance is removed, not other similarly "equal" instances.

Parameters
element:IonValue

the element to be removed from this container, if present.

Returns:boolean

true if this container contained the specified element.

Exceptions
NullPointerException:
if the element is null.
sizeback to summary
public int size()

Returns the number of elements in this container.

Returns:int

the number of elements, zero if this.isNullValue().