/** * Adds the provided value to the tail of the sequence of attribute values that compose the * {@link RevFeature} being built. * <p> * In order to preserve the {@link RevFeature}'s immutability, a safe copy of the value will be * assigned if it's a mutable type. * * @see FieldType#safeCopy(Object) */ public RevFeatureBuilder addValue(@Nullable Object value) { return addValueNoCopy(safeCopy(value)); }
public RevFeature readFeature(@Nullable ObjectId id, DataInput in) throws IOException { final int count = readUnsignedVarInt(in); final RevFeatureBuilder builder = RevFeatureBuilder.builder(); for (int i = 0; i < count; i++) { final byte fieldTag = in.readByte(); final FieldType fieldType = FieldType.valueOf(fieldTag); Object value = valueEncoder.decode(fieldType, in); builder.addValueNoCopy(value); } RevFeature built = id == null ? builder.build() : builder.build(id); return built; }