Class _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 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 by myFactory.
      • newBlob

        public IonBlob newBlob​(byte[] value)
        Description copied from interface: ValueFactory
        Constructs a new Ion blob instance, copying bytes from an array.
        Specified by:
        newBlob in interface ValueFactory
        Parameters:
        value - the data for the new blob, to be copied from the given array into the new instance. May be null to create a null.blob value.
      • newBlob

        public IonBlob newBlob​(byte[] value,
                               int offset,
                               int length)
        Description copied from interface: ValueFactory
        Constructs a new Ion blob, copying bytes from part of an array.

        This method copies length bytes from the given array into the new value, starting at the given offset in the array.

        Specified by:
        newBlob in interface ValueFactory
        Parameters:
        value - the data for the new blob, to be copied from the given array into the new instance. May be null to create a null.blob value.
        offset - the offset within the array of the first byte to copy; must be non-negative and no larger than bytes.length.
        length - the number of bytes to be copied from the given array; must be non-negative and no larger than bytes.length - offset.
      • newBool

        public IonBool newBool​(boolean value)
        Description copied from interface: ValueFactory
        Constructs a new bool instance with the given value.
        Specified by:
        newBool in interface ValueFactory
        Parameters:
        value - the new bool's value.
        Returns:
        a bool with IonBool.booleanValue() == value.
      • newBool

        public IonBool newBool​(java.lang.Boolean value)
        Description copied from interface: ValueFactory
        Constructs a new bool instance with the given value.
        Specified by:
        newBool in interface ValueFactory
        Parameters:
        value - the new bool's value. may be null to make null.bool.
      • newClob

        public IonClob newClob​(byte[] value)
        Description copied from interface: ValueFactory
        Constructs a new Ion clob instance from a byte array.
        Specified by:
        newClob in interface ValueFactory
        Parameters:
        value - the data for the new clob, to be copied from the given array into the new instance. May be null to create a null.clob value.
      • newClob

        public IonClob newClob​(byte[] value,
                               int offset,
                               int length)
        Description copied from interface: ValueFactory
        Constructs a new Ion clob, copying bytes from part of an array.

        This method copies length bytes from the given array into the new value, starting at the given offset in the array.

        Specified by:
        newClob in interface ValueFactory
        Parameters:
        value - the data for the new blob, to be copied from the given array into the new instance. May be null to create a null.clob value.
        offset - the offset within the array of the first byte to copy; must be non-negative an no larger than bytes.length.
        length - the number of bytes to be copied from the given array; must be non-negative an no larger than bytes.length - offset.
      • newDecimal

        public IonDecimal newDecimal​(double value)
        Description copied from interface: ValueFactory
        Constructs a new Ion decimal instance from a Java double.

        Note that this does not generate the exact decimal representation of the double's binary floating-point value as via BigDecimal(double), but instead uses the more predictable behavior of matching the double's string representation as via BigDecimal.valueOf(double).

        Specified by:
        newDecimal in interface ValueFactory
      • newDecimal

        public IonDecimal newDecimal​(java.math.BigInteger value)
        Description copied from interface: ValueFactory
        Constructs a new Ion decimal instance from a Java BigInteger.
        Specified by:
        newDecimal in interface ValueFactory
      • newDecimal

        public IonDecimal newDecimal​(java.math.BigDecimal value)
        Description copied from interface: ValueFactory
        Constructs a new Ion decimal instance from a Java BigDecimal. To create negative zero values, pass a Decimal.
        Specified by:
        newDecimal in interface ValueFactory
      • newFloat

        public IonFloat newFloat​(long value)
        Description copied from interface: ValueFactory
        Constructs a new Ion float instance from a Java long.
        Specified by:
        newFloat in interface ValueFactory
      • newFloat

        public IonFloat newFloat​(double value)
        Description copied from interface: ValueFactory
        Constructs a new Ion float instance from a Java double.
        Specified by:
        newFloat in interface ValueFactory
      • newInt

        public IonInt newInt​(int value)
        Description copied from interface: ValueFactory
        Constructs a new int instance with the given value.
        Specified by:
        newInt in interface ValueFactory
        Parameters:
        value - the new int's value.
      • newInt

        public IonInt newInt​(long value)
        Description copied from interface: ValueFactory
        Constructs a new int instance with the given value.
        Specified by:
        newInt in interface ValueFactory
        Parameters:
        value - the new int's value.
      • newInt

        public IonInt newInt​(java.lang.Number value)
        Description copied from interface: ValueFactory
        Constructs a new int instance with the given value. The integer portion of the number is used, any fractional portion is ignored.
        Specified by:
        newInt in interface ValueFactory
        Parameters:
        value - the new int's value; may be null to make null.int.
      • newList

        public IonList newList​(int[] values)
        Description copied from interface: ValueFactory
        Constructs a new list with given int children.
        Specified by:
        newList in interface ValueFactory
        Parameters:
        values - the initial set of child values. If null, then the new instance will have IonValue.isNullValue() == true. Otherwise, the resulting sequence will contain new IonInts with the given values.
        Returns:
        a new list where each element is an IonInt.
      • newList

        public IonList newList​(long[] values)
        Description copied from interface: ValueFactory
        Constructs a new list with given long child elements.
        Specified by:
        newList in interface ValueFactory
        Parameters:
        values - the initial set of child values. If null, then the new instance will have IonValue.isNullValue() == true. Otherwise, the resulting sequence will contain new IonInts with the given values.
        Returns:
        a new list where each element is an IonInt.
      • newSexp

        public IonSexp newSexp​(int[] values)
        Description copied from interface: ValueFactory
        Constructs a new sexp with given int child values.
        Specified by:
        newSexp in interface ValueFactory
        Parameters:
        values - the initial set of child values. If null, then the new instance will have IonValue.isNullValue() == true. Otherwise, the resulting sequence will contain new IonInts with the given values.
        Returns:
        a new sexp where each element is an IonInt.
      • newSexp

        public IonSexp newSexp​(long[] values)
        Description copied from interface: ValueFactory
        Constructs a new sexp with given long child elements.
        Specified by:
        newSexp in interface ValueFactory
        Parameters:
        values - the initial set of child values. If null, then the new instance will have IonValue.isNullValue() == true. Otherwise, the resulting sequence will contain new IonInts with the given values.
        Returns:
        a new sexp where each element is an IonInt.
      • newString

        public IonString newString​(java.lang.String value)
        Description copied from interface: ValueFactory
        Constructs a new Ion string with the given value.
        Specified by:
        newString in interface ValueFactory
        Parameters:
        value - the text of the new string; may be null to make null.string.
      • newSymbol

        public IonSymbol newSymbol​(java.lang.String value)
        Description copied from interface: ValueFactory
        Constructs a new Ion symbol with the given value.
        Specified by:
        newSymbol in interface ValueFactory
        Parameters:
        value - the text of the symbol; may be null to make null.symbol.
      • newSymbol

        public IonSymbol newSymbol​(SymbolToken value)
        Description copied from interface: ValueFactory
        Constructs 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:
        newSymbol in interface ValueFactory
        Parameters:
        value - the text and/or SID of the symbol; may be null to make null.symbol.
      • newTimestamp

        public IonTimestamp newTimestamp​(Timestamp value)
        Description copied from interface: ValueFactory
        Constructs a new timestamp instance with the given value.
        Specified by:
        newTimestamp in interface ValueFactory
        Parameters:
        value - may be null to make null.timestamp.
      • clone

        public <T extends IonValue> T clone​(T value)
                                     throws IonException
        Description copied from interface: ValueFactory
        Creates a deep copy of an Ion value. This method can properly clone IonDatagrams.

        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:
        clone in interface ValueFactory
        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()