struct value.Warning
This interface should not be implemented or extended by code outside of this library.
Note that this cannot extend java. because that interface
requires unique keys, while Ion's structs allow duplicate field names.
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | add(SymbolToken
the name of the new field. fieldName, IonValue the value of the new field. child)Adds a new field to this struct using a given name and/or SID. |
| public ValueFactory | |
| public IonStruct | clone()
Redeclares com. Creates a copy of this value and all of its children. |
| public IonStruct | cloneAndRemove(String...
the names of the fields to remove.
A null field name causes removal of fields with unknown names. fieldNames)Clones this struct, excluding certain fields. |
| public IonStruct | cloneAndRetain(String...
the names of the fields to retain.
Nulls are not allowed. fieldNames)Clones this struct, including only certain fields. |
| public boolean | Returns: true if this struct contains a field for the
specified field namefield name whose presence in this struct is to be tested fieldName)Determines whether this struct contains one or more fields for the specified field name (i.e., key). |
| public boolean | Returns: true if this struct contains a field for the
specified valuevalue whose presence in this struct is to be tested value)Determines whether this struct contains one or more fields with the specified value. |
| public IonValue | |
| public void | |
| public ValueFactory | |
| public void | |
| public IonValue | |
| public boolean | |
| public boolean | |
| public int | Returns: the number of fields.Redeclares com. Gets the number of fields in this struct. |
| add | back to summary |
|---|---|
| public void add(String fieldName, IonValue child) throws ContainedValueException Adds a new field to this struct.
If this is If a field with the given name already exists in this struct, this call will result in repeated fields.
| |
| add | back to summary |
|---|---|
| public void add(SymbolToken fieldName, IonValue child) throws ContainedValueException Adds a new field to this struct using a given name and/or SID.
If this is If a field with the given name already exists in this struct, this call will result in repeated fields. This is an "expert method": correct use requires deep understanding of the Ion binary format. You almost certainly don't want to use it.
| |
| add | back to summary |
|---|---|
| public ValueFactory add(String fieldName) Provides a factory that when invoked constructs a new value and
These two lines are equivalent:
str.add("f").newInt(3);
str.add("f", str.getSystem().newInt(3));
| |
| clone | back to summary |
|---|---|
| public IonStruct clone() throws UnknownSymbolException Redeclares com. Doc from com. 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
The cloned value will be created in the context of the same
| |
| cloneAndRemove | back to summary |
|---|---|
| public IonStruct cloneAndRemove(String... fieldNames) throws UnknownSymbolException Clones this struct, excluding certain fields. This can be more efficient than cloning the struct and removing fields later on.
| |
| cloneAndRetain | back to summary |
|---|---|
| public IonStruct cloneAndRetain(String... fieldNames) throws UnknownSymbolException Clones this struct, including only certain fields. This can be more efficient than cloning the struct and removing fields later on.
| |
| containsKey | back to summary |
|---|---|
| public boolean containsKey(Object fieldName) Determines whether this struct contains one or more fields for the specified field name (i.e., key). If this struct is an Ion null value, it will behave like an empty struct.
| |
| containsValue | back to summary |
|---|---|
| public boolean containsValue(Object value) Determines whether this struct contains one or more fields with the specified value. If this struct is an Ion null value, it will behave like an empty struct. This uses reference equality to compare the specified value with the value of the struct fields.
| |
| get | back to summary |
|---|---|
| public IonValue get(String fieldName) Gets the value of a field in this struct. If the field name appears
more than once, one of the fields will be selected arbitrarily. For
example, calling
{ a:1, b:2, a:3 }
will return either 1 or 3.
| |
| put | back to summary |
|---|---|
| public void put(String fieldName, IonValue child) throws ContainedValueException Puts a new field in this struct, replacing all existing fields
with the same name. If
If this is
The effect of this method is such that if
| |
| put | back to summary |
|---|---|
| public ValueFactory put(String fieldName) Provides a factory that when invoked constructs a new value and
These two lines are equivalent:
str.put("f").newInt(3);
str.put("f", str.getSystem().newInt(3));
| |
| putAll | back to summary |
|---|---|
| public void putAll(Map<? extends String, ? extends IonValue> m) Copies all of the mappings from the specified map to this struct.
The effect of this call is equivalent to that of calling
If a key in the map maps to
| |
| remove | back to summary |
|---|---|
| public IonValue remove(String fieldName) Removes a field by name, returning a value that was previously
associated with the field, or Because Ion structs may have repeated fields, additional fields with the given name may still exist after this method returns. If this struct is an Ion null value or empty, then this method returns null and has no effect. | |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(String... fieldNames) Removes from this struct all fields with names in the given list. If multiple fields with a given name exist in this struct, they will all be removed.
If this struct is an Ion null value or empty,
then this method returns
| |
| retainAll | back to summary |
|---|---|
| public boolean retainAll(String... fieldNames) Retains only the fields in this struct that have one of the given names.
In other words, removes all fields with names that are not in
If this struct is an Ion null value or empty,
then this method returns
| |
| size | back to summary |
|---|---|
| public int size() throws NullValueException Redeclares com. Gets the number of fields in this struct. If any field names are
repeated, they are counted individually. For example, the size of
| |