/** * Adds the integer value to the end of this array. * * @param value the integer value; may not be null * @return this array to allow for chaining methods */ default Array add(int value) { add(Value.create(value)); return this; }
/** * Adds the float value to the end of this array. * * @param value the float value; may not be null * @return this array to allow for chaining methods */ default Array add(float value) { add(Value.create(value)); return this; }
/** * Adds the big integer value to the end of this array. * * @param value the big integer value; may be null if a {@link #addNull() null value} should be added * @return this array to allow for chaining methods */ default Array add(BigInteger value) { add(Value.create(value)); return this; }
/** * Adds the document value to the end of this array. * * @param value the document value; may be null if a {@link #addNull() null value} should be added * @return this array to allow for chaining methods */ default Array add(Document value) { add(Value.create(value)); return this; }
/** * Adds the double value to the end of this array. * * @param value the double value; may not be null * @return this array to allow for chaining methods */ default Array add(double value) { add(Value.create(value)); return this; }
/** * Adds the boolean value to the end of this array. * * @param value the boolean value; may be null if a {@link #addNull() null value} should be added * @return this array to allow for chaining methods */ default Array add(Boolean value) { add(Value.create(value)); return this; }
/** * Adds the long value to the end of this array. * * @param value the long value; may not be null * @return this array to allow for chaining methods */ default Array add(long value) { add(Value.create(value)); return this; }
/** * Adds the decimal value to the end of this array. * * @param value the decimal value; may be null if a {@link #addNull() null value} should be added * @return this array to allow for chaining methods */ default Array add(BigDecimal value) { add(Value.create(value)); return this; }
/** * Adds the long value to the end of this array. * * @param value the long value; may be null if a {@link #addNull() null value} should be added * @return this array to allow for chaining methods */ default Array add(Long value) { add(Value.create(value)); return this; }
/** * Adds the double value to the end of this array. * * @param value the double value; may be null if a {@link #addNull() null value} should be added * @return this array to allow for chaining methods */ default Array add(Double value) { add(Value.create(value)); return this; }
/** * Adds the array value to the end of this array. * * @param value the array value; may be null if a {@link #addNull() null value} should be added * @return this array to allow for chaining methods */ default Array add(Array value) { add(Value.create(value)); return this; }
/** * Adds a null value to the end of this array. * * @return this array to allow for chaining methods */ default Array addNull() { add(Value.nullValue()); return this; }
/** * Adds the string value to the end of this array. * * @param value the string value; may be null if a {@link #addNull() null value} should be added * @return this array to allow for chaining methods */ default Array add(String value) { add(Value.create(value)); return this; }
/** * Adds the boolean value to the end of this array. * * @param value the boolean value; may not be null * @return this array to allow for chaining methods */ default Array add(boolean value) { add(Value.create(value)); return this; }
/** * Adds the integer value to the end of this array. * * @param value the integer value; may be null if a {@link #addNull() null value} should be added * @return this array to allow for chaining methods */ default Array add(Integer value) { add(Value.create(value)); return this; }
/** * Adds the float value to the end of this array. * * @param value the float value; may be null if a {@link #addNull() null value} should be added * @return this array to allow for chaining methods */ default Array add(Float value) { add(Value.create(value)); return this; }
/** * Sets on this object all name/value pairs from the supplied object. If the supplied object is null, this method does * nothing. * * @param values the values to be added to this array * @return this array to allow for chaining methods */ default Array addAll(Iterable<Value> values) { if (values != null) { values.forEach(value -> add(value != null ? value.clone() : Value.nullValue())); } return this; }
/** * Sets on this object all name/value pairs from the supplied object. If the supplied object is null, this method does * nothing. * * @param values the values to be added to this array * @return this array to allow for chaining methods */ default Array addAll(Stream<Value> values) { if (values != null) { values.forEach(value -> add(value != null ? value.clone() : Value.nullValue())); } return this; }
@Test public void shouldWriteDocumentWithSingleField() throws Exception { array.add("value1"); after = reader.readArray(writer.write(array)); assertThat(after.get(0)).isEqualTo("value1"); assertThat(after.size()).isEqualTo(1); }