Class _Private_CurriedValueFactory
- java.lang.Object
-
- com.amazon.ion.impl._Private_CurriedValueFactory
-
- All Implemented Interfaces:
ValueFactory
public abstract class _Private_CurriedValueFactory extends java.lang.Object implements ValueFactory
NOT FOR APPLICATION USE!Helper for implementing curried container insertion methods such as
IonStruct.put(String).
-
-
Constructor Summary
Constructors Modifier Constructor Description protected_Private_CurriedValueFactory(ValueFactory factory)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T extends IonValue>
Tclone(T value)Creates a deep copy of an Ion value.protected abstract voidhandle(IonValue newValue)Subclasses override this to do something with each newly-constructed value.IonBlobnewBlob(byte[] value)Constructs a new Ionblobinstance, copying bytes from an array.IonBlobnewBlob(byte[] value, int offset, int length)Constructs a new Ionblob, copying bytes from part of an array.IonBoolnewBool(boolean value)Constructs a newboolinstance with the given value.IonBoolnewBool(java.lang.Boolean value)Constructs a newboolinstance with the given value.IonClobnewClob(byte[] value)Constructs a new Ionclobinstance from a byte array.IonClobnewClob(byte[] value, int offset, int length)Constructs a new Ionclob, copying bytes from part of an array.IonDecimalnewDecimal(double value)Constructs a new Iondecimalinstance from a Javadouble.IonDecimalnewDecimal(long value)Constructs a new Iondecimalinstance from a Javalong.IonDecimalnewDecimal(java.math.BigDecimal value)Constructs a new Iondecimalinstance from a JavaBigDecimal.IonDecimalnewDecimal(java.math.BigInteger value)Constructs a new Iondecimalinstance from a JavaBigInteger.IonListnewEmptyList()Constructs a new empty (not null)listinstance.IonSexpnewEmptySexp()Constructs a new empty (not null)sexpinstance.IonStructnewEmptyStruct()Constructs a new empty (not null)structinstance.IonFloatnewFloat(double value)Constructs a new Ionfloatinstance from a Javadouble.IonFloatnewFloat(long value)Constructs a new Ionfloatinstance from a Javalong.IonIntnewInt(int value)Constructs a newintinstance with the given value.IonIntnewInt(long value)Constructs a newintinstance with the given value.IonIntnewInt(java.lang.Number value)Constructs a newintinstance with the given value.IonListnewList(int[] values)Constructs a newlistwith givenintchildren.IonListnewList(long[] values)Constructs a newlistwith givenlongchild elements.IonListnewList(IonSequence firstChild)Constructs a newlistwith the given child.IonListnewList(IonValue... values)Constructs a newlistwith the given children.IonListnewList(java.util.Collection<? extends IonValue> values)Deprecated.IonNullnewNull()Constructs a newnull.nullinstance.IonValuenewNull(IonType type)Constructs a new Ion null value with the given type.IonBlobnewNullBlob()Constructs a newnull.blobinstance.IonBoolnewNullBool()Constructs a newnull.boolinstance.IonClobnewNullClob()Constructs a newnull.clobinstance.IonDecimalnewNullDecimal()Constructs a newnull.decimalinstance.IonFloatnewNullFloat()Constructs a newnull.floatinstance.IonIntnewNullInt()Constructs a newnull.intinstance.IonListnewNullList()Constructs a newnull.listinstance.IonSexpnewNullSexp()Constructs a newnull.sexpinstance.IonStringnewNullString()Constructs a newnull.stringinstance.IonStructnewNullStruct()Constructs a newnull.structinstance.IonSymbolnewNullSymbol()Constructs a newnull.symbolinstance.IonTimestampnewNullTimestamp()Constructs a newnull.timestampinstance.IonSexpnewSexp(int[] values)Constructs a newsexpwith givenintchild values.IonSexpnewSexp(long[] values)Constructs a newsexpwith givenlongchild elements.IonSexpnewSexp(IonSequence firstChild)Constructs a newsexpwith the given child.IonSexpnewSexp(IonValue... values)Constructs a newsexpwith given child elements.IonSexpnewSexp(java.util.Collection<? extends IonValue> values)Deprecated.IonStringnewString(java.lang.String value)Constructs a new Ion string with the given value.IonSymbolnewSymbol(SymbolToken value)Constructs a new Ion symbol with the given symbol token.IonSymbolnewSymbol(java.lang.String value)Constructs a new Ion symbol with the given value.IonTimestampnewTimestamp(Timestamp value)Constructs a newtimestampinstance with the given value.
-
-
-
Constructor Detail
-
_Private_CurriedValueFactory
protected _Private_CurriedValueFactory(ValueFactory factory)
- Parameters:
factory- must not be null.
-
-
Method Detail
-
handle
protected abstract void handle(IonValue newValue)
Subclasses override this to do something with each newly-constructed value.- Parameters:
newValue- was just constructed bymyFactory.
-
newNullBlob
public IonBlob newNullBlob()
Description copied from interface:ValueFactoryConstructs a newnull.blobinstance.- Specified by:
newNullBlobin interfaceValueFactory
-
newBlob
public IonBlob newBlob(byte[] value)
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
public IonBlob newBlob(byte[] value, int offset, int length)
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
public IonBool newNullBool()
Description copied from interface:ValueFactoryConstructs a newnull.boolinstance.- Specified by:
newNullBoolin interfaceValueFactory
-
newBool
public IonBool newBool(boolean value)
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
public IonBool newBool(java.lang.Boolean value)
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
public IonClob newNullClob()
Description copied from interface:ValueFactoryConstructs a newnull.clobinstance.- Specified by:
newNullClobin interfaceValueFactory
-
newClob
public IonClob newClob(byte[] value)
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
public IonClob newClob(byte[] value, int offset, int length)
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
public IonDecimal newNullDecimal()
Description copied from interface:ValueFactoryConstructs a newnull.decimalinstance.- Specified by:
newNullDecimalin interfaceValueFactory
-
newDecimal
public IonDecimal newDecimal(long value)
Description copied from interface:ValueFactoryConstructs a new Iondecimalinstance from a Javalong.- Specified by:
newDecimalin interfaceValueFactory
-
newDecimal
public IonDecimal newDecimal(double value)
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
public IonDecimal newDecimal(java.math.BigInteger value)
Description copied from interface:ValueFactoryConstructs a new Iondecimalinstance from a JavaBigInteger.- Specified by:
newDecimalin interfaceValueFactory
-
newDecimal
public IonDecimal newDecimal(java.math.BigDecimal value)
Description copied from interface:ValueFactoryConstructs a new Iondecimalinstance from a JavaBigDecimal. To create negative zero values, pass aDecimal.- Specified by:
newDecimalin interfaceValueFactory
-
newNullFloat
public IonFloat newNullFloat()
Description copied from interface:ValueFactoryConstructs a newnull.floatinstance.- Specified by:
newNullFloatin interfaceValueFactory
-
newFloat
public IonFloat newFloat(long value)
Description copied from interface:ValueFactoryConstructs a new Ionfloatinstance from a Javalong.- Specified by:
newFloatin interfaceValueFactory
-
newFloat
public IonFloat newFloat(double value)
Description copied from interface:ValueFactoryConstructs a new Ionfloatinstance from a Javadouble.- Specified by:
newFloatin interfaceValueFactory
-
newNullInt
public IonInt newNullInt()
Description copied from interface:ValueFactoryConstructs a newnull.intinstance.- Specified by:
newNullIntin interfaceValueFactory
-
newInt
public IonInt newInt(int value)
Description copied from interface:ValueFactoryConstructs a newintinstance with the given value.- Specified by:
newIntin interfaceValueFactory- Parameters:
value- the new int's value.
-
newInt
public IonInt newInt(long value)
Description copied from interface:ValueFactoryConstructs a newintinstance with the given value.- Specified by:
newIntin interfaceValueFactory- Parameters:
value- the new int's value.
-
newInt
public IonInt newInt(java.lang.Number value)
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
public IonList newNullList()
Description copied from interface:ValueFactoryConstructs a newnull.listinstance.- Specified by:
newNullListin interfaceValueFactory
-
newEmptyList
public IonList newEmptyList()
Description copied from interface:ValueFactoryConstructs a new empty (not null)listinstance.- Specified by:
newEmptyListin interfaceValueFactory
-
newList
@Deprecated public IonList newList(java.util.Collection<? extends IonValue> values) throws ContainedValueException, java.lang.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()!= nulljava.lang.NullPointerException- if any value invaluesis null.
-
newList
public IonList newList(IonSequence firstChild) throws ContainedValueException, java.lang.NullPointerException
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()!= nulljava.lang.NullPointerException- ifchildis null.
-
newList
public IonList newList(IonValue... values) throws ContainedValueException, java.lang.NullPointerException
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()!= nulljava.lang.NullPointerException- if any child is null.
-
newList
public IonList newList(int[] values)
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
public IonList newList(long[] values)
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
public IonNull newNull()
Description copied from interface:ValueFactoryConstructs a newnull.nullinstance.- Specified by:
newNullin interfaceValueFactory
-
newNull
public IonValue newNull(IonType type)
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
public IonSexp newNullSexp()
Description copied from interface:ValueFactoryConstructs a newnull.sexpinstance.- Specified by:
newNullSexpin interfaceValueFactory
-
newEmptySexp
public IonSexp newEmptySexp()
Description copied from interface:ValueFactoryConstructs a new empty (not null)sexpinstance.- Specified by:
newEmptySexpin interfaceValueFactory
-
newSexp
@Deprecated public IonSexp newSexp(java.util.Collection<? extends IonValue> values) throws ContainedValueException, java.lang.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()!= nulljava.lang.NullPointerException- if any value invaluesis null.
-
newSexp
public IonSexp newSexp(IonSequence firstChild) throws ContainedValueException, java.lang.NullPointerException
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()!= nulljava.lang.NullPointerException- ifchildis null.
-
newSexp
public IonSexp newSexp(IonValue... values) throws ContainedValueException, java.lang.NullPointerException
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()!= nulljava.lang.NullPointerException- if any child is null.
-
newSexp
public IonSexp newSexp(int[] values)
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
public IonSexp newSexp(long[] values)
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
public IonString newNullString()
Description copied from interface:ValueFactoryConstructs a newnull.stringinstance.- Specified by:
newNullStringin interfaceValueFactory
-
newString
public IonString newString(java.lang.String value)
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
public IonStruct newNullStruct()
Description copied from interface:ValueFactoryConstructs a newnull.structinstance.- Specified by:
newNullStructin interfaceValueFactory
-
newEmptyStruct
public IonStruct newEmptyStruct()
Description copied from interface:ValueFactoryConstructs a new empty (not null)structinstance.- Specified by:
newEmptyStructin interfaceValueFactory
-
newNullSymbol
public IonSymbol newNullSymbol()
Description copied from interface:ValueFactoryConstructs a newnull.symbolinstance.- Specified by:
newNullSymbolin interfaceValueFactory
-
newSymbol
public IonSymbol newSymbol(java.lang.String value)
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
public IonSymbol newSymbol(SymbolToken value)
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
public IonTimestamp newNullTimestamp()
Description copied from interface:ValueFactoryConstructs a newnull.timestampinstance.- Specified by:
newNullTimestampin interfaceValueFactory
-
newTimestamp
public IonTimestamp newTimestamp(Timestamp value)
Description copied from interface:ValueFactoryConstructs a newtimestampinstance with the given value.- Specified by:
newTimestampin interfaceValueFactory- Parameters:
value- may benullto makenull.timestamp.
-
clone
public <T extends IonValue> T clone(T value) throws IonException
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.UnknownSymbolException- if any part of this value has unknown text but known Sid for its field name, annotation or symbol.- See Also:
IonValue.clone()
-
-