Class _Private_CurriedValueFactory
- All Implemented Interfaces:
ValueFactory
Helper for implementing curried container insertion methods such as
IonStruct.put(String).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends IonValue>
Tclone(T value) Creates a deep copy of an Ion value.protected abstract voidSubclasses override this to do something with each newly-constructed value.newBlob(byte[] value) Constructs a new Ionblobinstance, copying bytes from an array.newBlob(byte[] value, int offset, int length) Constructs a new Ionblob, copying bytes from part of an array.newBool(boolean value) Constructs a newboolinstance with the given value.Constructs a newboolinstance with the given value.newClob(byte[] value) Constructs a new Ionclobinstance from a byte array.newClob(byte[] value, int offset, int length) Constructs a new Ionclob, copying bytes from part of an array.newDecimal(double value) Constructs a new Iondecimalinstance from a Javadouble.newDecimal(long value) Constructs a new Iondecimalinstance from a Javalong.newDecimal(BigDecimal value) Constructs a new Iondecimalinstance from a JavaBigDecimal.newDecimal(BigInteger value) Constructs a new Iondecimalinstance from a JavaBigInteger.Constructs a new empty (not null)listinstance.Constructs a new empty (not null)sexpinstance.Constructs a new empty (not null)structinstance.newFloat(double value) Constructs a new Ionfloatinstance from a Javadouble.newFloat(long value) Constructs a new Ionfloatinstance from a Javalong.newInt(int value) Constructs a newintinstance with the given value.newInt(long value) Constructs a newintinstance with the given value.Constructs a newintinstance with the given value.newList(int[] values) Constructs a newlistwith givenintchildren.newList(long[] values) Constructs a newlistwith givenlongchild elements.newList(IonSequence firstChild) Constructs a newlistwith the given child.Constructs a newlistwith the given children.newList(Collection<? extends IonValue> values) Deprecated.newNull()Constructs a newnull.nullinstance.Constructs a new Ion null value with the given type.Constructs a newnull.blobinstance.Constructs a newnull.boolinstance.Constructs a newnull.clobinstance.Constructs a newnull.decimalinstance.Constructs a newnull.floatinstance.Constructs a newnull.intinstance.Constructs a newnull.listinstance.Constructs a newnull.sexpinstance.Constructs a newnull.stringinstance.Constructs a newnull.structinstance.Constructs a newnull.symbolinstance.Constructs a newnull.timestampinstance.newSexp(int[] values) Constructs a newsexpwith givenintchild values.newSexp(long[] values) Constructs a newsexpwith givenlongchild elements.newSexp(IonSequence firstChild) Constructs a newsexpwith the given child.Constructs a newsexpwith given child elements.newSexp(Collection<? extends IonValue> values) Deprecated.Constructs a new Ion string with the given value.newSymbol(SymbolToken value) Constructs a new Ion symbol with the given symbol token.Constructs a new Ion symbol with the given value.newTimestamp(Timestamp value) Constructs a newtimestampinstance with the given value.
-
Constructor Details
-
_Private_CurriedValueFactory
- Parameters:
factory- must not be null.
-
-
Method Details
-
handle
Subclasses override this to do something with each newly-constructed value.- Parameters:
newValue- was just constructed bymyFactory.
-
newNullBlob
Description copied from interface:ValueFactoryConstructs a newnull.blobinstance.- Specified by:
newNullBlobin interfaceValueFactory
-
newBlob
Description copied from interface:ValueFactoryConstructs a new Ionblobinstance, copying bytes from an array.- Specified by:
newBlobin interfaceValueFactory- Parameters:
value- the data for the new blob, to be copied from the given array into the new instance. May benullto create anull.blobvalue.
-
newBlob
Description copied from interface:ValueFactoryConstructs a new Ionblob, copying bytes from part of an array.This method copies
lengthbytes from the given array into the new value, starting at the given offset in the array.- Specified by:
newBlobin interfaceValueFactory- Parameters:
value- the data for the new blob, to be copied from the given array into the new instance. May benullto create anull.blobvalue.offset- the offset within the array of the first byte to copy; must be non-negative and no larger thanbytes.length.length- the number of bytes to be copied from the given array; must be non-negative and no larger thanbytes.length - offset.
-
newNullBool
Description copied from interface:ValueFactoryConstructs a newnull.boolinstance.- Specified by:
newNullBoolin interfaceValueFactory
-
newBool
Description copied from interface:ValueFactoryConstructs a newboolinstance with the given value.- Specified by:
newBoolin interfaceValueFactory- Parameters:
value- the newbool's value.- Returns:
- a bool with
.IonBool.booleanValue()== value
-
newBool
Description copied from interface:ValueFactoryConstructs a newboolinstance with the given value.- Specified by:
newBoolin interfaceValueFactory- Parameters:
value- the newbool's value. may benullto makenull.bool.
-
newNullClob
Description copied from interface:ValueFactoryConstructs a newnull.clobinstance.- Specified by:
newNullClobin interfaceValueFactory
-
newClob
Description copied from interface:ValueFactoryConstructs a new Ionclobinstance from a byte array.- Specified by:
newClobin interfaceValueFactory- Parameters:
value- the data for the new clob, to be copied from the given array into the new instance. May benullto create anull.clobvalue.
-
newClob
Description copied from interface:ValueFactoryConstructs a new Ionclob, copying bytes from part of an array.This method copies
lengthbytes from the given array into the new value, starting at the given offset in the array.- Specified by:
newClobin interfaceValueFactory- Parameters:
value- the data for the new blob, to be copied from the given array into the new instance. May benullto create anull.clobvalue.offset- the offset within the array of the first byte to copy; must be non-negative an no larger thanbytes.length.length- the number of bytes to be copied from the given array; must be non-negative an no larger thanbytes.length - offset.
-
newNullDecimal
Description copied from interface:ValueFactoryConstructs a newnull.decimalinstance.- Specified by:
newNullDecimalin interfaceValueFactory
-
newDecimal
Description copied from interface:ValueFactoryConstructs a new Iondecimalinstance from a Javalong.- Specified by:
newDecimalin interfaceValueFactory
-
newDecimal
Description copied from interface:ValueFactoryConstructs a new Iondecimalinstance from a Javadouble.Note that this does not generate the exact decimal representation of the
double's binary floating-point value as viaBigDecimal(double), but instead uses the more predictable behavior of matching the double's string representation as viaBigDecimal.valueOf(double).- Specified by:
newDecimalin interfaceValueFactory
-
newDecimal
Description copied from interface:ValueFactoryConstructs a new Iondecimalinstance from a JavaBigInteger.- Specified by:
newDecimalin interfaceValueFactory
-
newDecimal
Description copied from interface:ValueFactoryConstructs a new Iondecimalinstance from a JavaBigDecimal. To create negative zero values, pass aDecimal.- Specified by:
newDecimalin interfaceValueFactory
-
newNullFloat
Description copied from interface:ValueFactoryConstructs a newnull.floatinstance.- Specified by:
newNullFloatin interfaceValueFactory
-
newFloat
Description copied from interface:ValueFactoryConstructs a new Ionfloatinstance from a Javalong.- Specified by:
newFloatin interfaceValueFactory
-
newFloat
Description copied from interface:ValueFactoryConstructs a new Ionfloatinstance from a Javadouble.- Specified by:
newFloatin interfaceValueFactory
-
newNullInt
Description copied from interface:ValueFactoryConstructs a newnull.intinstance.- Specified by:
newNullIntin interfaceValueFactory
-
newInt
Description copied from interface:ValueFactoryConstructs a newintinstance with the given value.- Specified by:
newIntin interfaceValueFactory- Parameters:
value- the new int's value.
-
newInt
Description copied from interface:ValueFactoryConstructs a newintinstance with the given value.- Specified by:
newIntin interfaceValueFactory- Parameters:
value- the new int's value.
-
newInt
Description copied from interface:ValueFactoryConstructs a newintinstance with the given value. The integer portion of the number is used, any fractional portion is ignored.- Specified by:
newIntin interfaceValueFactory- Parameters:
value- the new int's value; may benullto makenull.int.
-
newNullList
Description copied from interface:ValueFactoryConstructs a newnull.listinstance.- Specified by:
newNullListin interfaceValueFactory
-
newEmptyList
Description copied from interface:ValueFactoryConstructs a new empty (not null)listinstance.- Specified by:
newEmptyListin interfaceValueFactory
-
newList
@Deprecated public IonList newList(Collection<? extends IonValue> values) throws ContainedValueException, NullPointerException Deprecated.Description copied from interface:ValueFactoryConstructs a newlistwith given children.- Specified by:
newListin interfaceValueFactory- Parameters:
values- the initial set of children. Ifnull, then the new instance will have.IonValue.isNullValue()== true- Throws:
ContainedValueException- if any value invalueshas.IonValue.getContainer()!= nullNullPointerException- if any value invaluesis null.
-
newList
Description copied from interface:ValueFactoryConstructs a newlistwith the given child.This method is temporary until
ValueFactory.newList(Collection)is removed. It's sole purpose is to avoid the doomed attempt to add all of the parameter's children to the new list; that will always throwContainedValueException.- Specified by:
newListin interfaceValueFactory- Parameters:
firstChild- the initial child of the new list.- Throws:
ContainedValueException- ifchildhas.IonValue.getContainer()!= nullNullPointerException- ifchildis null.
-
newList
Description copied from interface:ValueFactoryConstructs a newlistwith the given children.Some edge cases are worth examples:
factory.newList(); // returns [] factory.newList((IonValue[]) null); // returns null.listFor clarity, applications should preferValueFactory.newEmptyList()andValueFactory.newNullList()instead.- Specified by:
newListin interfaceValueFactory- Parameters:
values- the initial sequence of children. Ifnull, then the new instance will have.IonValue.isNullValue()== true- Throws:
ContainedValueException- if any child has.IonValue.getContainer()!= nullNullPointerException- if any child is null.
-
newList
Description copied from interface:ValueFactoryConstructs a newlistwith givenintchildren.- Specified by:
newListin interfaceValueFactory- Parameters:
values- the initial set of child values. Ifnull, then the new instance will have. Otherwise, the resulting sequence will contain newIonValue.isNullValue()== trueIonInts with the given values.- Returns:
- a new list where each element is an
IonInt.
-
newList
Description copied from interface:ValueFactoryConstructs a newlistwith givenlongchild elements.- Specified by:
newListin interfaceValueFactory- Parameters:
values- the initial set of child values. Ifnull, then the new instance will have. Otherwise, the resulting sequence will contain newIonValue.isNullValue()== trueIonInts with the given values.- Returns:
- a new list where each element is an
IonInt.
-
newNull
Description copied from interface:ValueFactoryConstructs a newnull.nullinstance.- Specified by:
newNullin interfaceValueFactory
-
newNull
Description copied from interface:ValueFactoryConstructs a new Ion null value with the given type.- Specified by:
newNullin interfaceValueFactory- Parameters:
type- must not be Java null, but it may beIonType.NULL.- Returns:
- a new value such that
IonValue.isNullValue()istrue.
-
newNullSexp
Description copied from interface:ValueFactoryConstructs a newnull.sexpinstance.- Specified by:
newNullSexpin interfaceValueFactory
-
newEmptySexp
Description copied from interface:ValueFactoryConstructs a new empty (not null)sexpinstance.- Specified by:
newEmptySexpin interfaceValueFactory
-
newSexp
@Deprecated public IonSexp newSexp(Collection<? extends IonValue> values) throws ContainedValueException, NullPointerException Deprecated.Description copied from interface:ValueFactoryConstructs a newsexpwith given child elements.- Specified by:
newSexpin interfaceValueFactory- Parameters:
values- the initial set of children. Ifnull, then the new instance will have.IonValue.isNullValue()== true- Throws:
ContainedValueException- if any value invalueshas.IonValue.getContainer()!= nullNullPointerException- if any value invaluesis null.
-
newSexp
Description copied from interface:ValueFactoryConstructs a newsexpwith the given child.This method is temporary until
ValueFactory.newSexp(Collection)is removed. It's sole purpose is to avoid the doomed attempt to add all of the parameter's children to the new sequence; that will always throwContainedValueException.- Specified by:
newSexpin interfaceValueFactory- Parameters:
firstChild- the initial child of the new sexp.- Throws:
ContainedValueException- ifchildhas.IonValue.getContainer()!= nullNullPointerException- ifchildis null.
-
newSexp
Description copied from interface:ValueFactoryConstructs a newsexpwith given child elements.Some edge cases are worth examples:
factory.newSexp(); // returns () factory.newSexp((IonValue[]) null); // returns null.sexpFor clarity, applications should preferValueFactory.newEmptySexp()andValueFactory.newNullSexp()instead.- Specified by:
newSexpin interfaceValueFactory- Parameters:
values- the initial set of children. Ifnull, then the new instance will have.IonValue.isNullValue()== true- Throws:
ContainedValueException- if any child has.IonValue.getContainer()!= nullNullPointerException- if any child is null.
-
newSexp
Description copied from interface:ValueFactoryConstructs a newsexpwith givenintchild values.- Specified by:
newSexpin interfaceValueFactory- Parameters:
values- the initial set of child values. Ifnull, then the new instance will have. Otherwise, the resulting sequence will contain newIonValue.isNullValue()== trueIonInts with the given values.- Returns:
- a new sexp where each element is an
IonInt.
-
newSexp
Description copied from interface:ValueFactoryConstructs a newsexpwith givenlongchild elements.- Specified by:
newSexpin interfaceValueFactory- Parameters:
values- the initial set of child values. Ifnull, then the new instance will have. Otherwise, the resulting sequence will contain newIonValue.isNullValue()== trueIonInts with the given values.- Returns:
- a new sexp where each element is an
IonInt.
-
newNullString
Description copied from interface:ValueFactoryConstructs a newnull.stringinstance.- Specified by:
newNullStringin interfaceValueFactory
-
newString
Description copied from interface:ValueFactoryConstructs a new Ion string with the given value.- Specified by:
newStringin interfaceValueFactory- Parameters:
value- the text of the new string; may benullto makenull.string.
-
newNullStruct
Description copied from interface:ValueFactoryConstructs a newnull.structinstance.- Specified by:
newNullStructin interfaceValueFactory
-
newEmptyStruct
Description copied from interface:ValueFactoryConstructs a new empty (not null)structinstance.- Specified by:
newEmptyStructin interfaceValueFactory
-
newNullSymbol
Description copied from interface:ValueFactoryConstructs a newnull.symbolinstance.- Specified by:
newNullSymbolin interfaceValueFactory
-
newSymbol
Description copied from interface:ValueFactoryConstructs a new Ion symbol with the given value.- Specified by:
newSymbolin interfaceValueFactory- Parameters:
value- the text of the symbol; may benullto makenull.symbol.
-
newSymbol
Description copied from interface:ValueFactoryConstructs a new Ion symbol with the given symbol token.This is an "expert method": correct use requires deep understanding of the Ion binary format. You almost certainly don't want to use it.
- Specified by:
newSymbolin interfaceValueFactory- Parameters:
value- the text and/or SID of the symbol; may benullto makenull.symbol.
-
newNullTimestamp
Description copied from interface:ValueFactoryConstructs a newnull.timestampinstance.- Specified by:
newNullTimestampin interfaceValueFactory
-
newTimestamp
Description copied from interface:ValueFactoryConstructs a newtimestampinstance with the given value.- Specified by:
newTimestampin interfaceValueFactory- Parameters:
value- may benullto makenull.timestamp.
-
clone
Description copied from interface:ValueFactoryCreates a deep copy of an Ion value. This method can properly cloneIonDatagrams.The given value can be in the context of any
ValueFactory, and the result will be in the context of this one. This allows you to shift data from one factory instance to another.- Specified by:
clonein interfaceValueFactory- Parameters:
value- the value to copy.- Returns:
- a deep copy of value, with no container.
- Throws:
IonException- if there's a problem creating the clone.- See Also:
-