Interface IonContainer
-
- All Known Subinterfaces:
_Private_IonContainer,_Private_IonDatagram,IonDatagram,IonList,IonSequence,IonSexp,IonStruct
public interface IonContainer extends IonValue, java.lang.Iterable<IonValue>
Common functionality of Ionstruct,list, andsexptypes.WARNING: This interface should not be implemented or extended by code outside of this library.
-
-
Field Summary
-
Fields inherited from interface com.amazon.ion.IonValue
EMPTY_ARRAY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Clears the contents of this container (if any) and set it to empty.IonContainerclone()Creates a copy of this value and all of its children.booleanisEmpty()Checks if this container is empty.java.util.Iterator<IonValue>iterator()Creates an iterator providing the (direct) elements of this container.voidmakeNull()Sets the contents of this container to an Ionnullvalue.booleanremove(IonValue element)Removes the given element from this container.intsize()Returns the number of elements in this container.-
Methods inherited from interface com.amazon.ion.IonValue
accept, addTypeAnnotation, clearTypeAnnotations, equals, getContainer, getFieldId, getFieldName, getFieldNameSymbol, getSymbolTable, getSystem, getType, getTypeAnnotations, getTypeAnnotationSymbols, hashCode, hasTypeAnnotation, isNullValue, isReadOnly, makeReadOnly, removeFromContainer, removeTypeAnnotation, setTypeAnnotations, setTypeAnnotationSymbols, topLevelValue, toPrettyString, toString, toString, writeTo
-
-
-
-
Method Detail
-
size
int size()
Returns the number of elements in this container.- Returns:
- the number of elements, zero if
this.isNullValue().
-
iterator
java.util.Iterator<IonValue> 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
IonStructhas unspecified ordering, while iteration over anIonSequence(IonListorIonSexp) must return elements in order of their appearance in the Ion representation.- Specified by:
iteratorin interfacejava.lang.Iterable<IonValue>- Returns:
- a new iterator, not
null.
-
remove
boolean remove(IonValue element)
Removes the given element from this container. If this is an Ion null value, then this method returnsfalse.Note that, unlike
Collection.remove(Object), this method uses object identity, notObject.equals(Object), to find the element. That is, the given instance is removed, not other similarly "equal" instances.- Parameters:
element- the element to be removed from this container, if present.- Returns:
trueif this container contained the specified element.- Throws:
java.lang.NullPointerException- if theelementisnull.
-
isEmpty
boolean isEmpty() throws NullValueExceptionChecks if this container is empty.- Returns:
trueif this container has no contents- Throws:
NullValueException- if this container is an Ionnullvalue
-
clear
void clear()
Clears the contents of this container (if any) and set it to empty. If this container is an Ionnullvalue, set it to empty.Use
makeNull()to make this container null rather than empty.WARNING: This method is not support for instances of
IonDatagram.
-
makeNull
void makeNull()
Sets the contents of this container to an Ionnullvalue.Use
clear()to make this container empty rather than null.
-
clone
IonContainer clone() throws UnknownSymbolException
Description copied from interface:IonValueCreates 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 instanceIonValue.isReadOnly().The cloned value will be created in the context of the same
ValueFactoryas this instance; if you want a copy using a different factory, then useValueFactory.clone(IonValue)instead.- Specified by:
clonein interfaceIonValue- Throws:
UnknownSymbolException- if any part of this value has unknown text but known Sid for its field name, annotation or symbol.
-
-