package org.textfiledatatools.core.record;

import org.textfiledatatools.core.Field;

import java.util.Objects;

/**
 * @author Mathias Kalb
 * @since 0.1
 */
public class KeyValueRecord extends PairRecord implements KeyRecord, ValueRecord {

    private static final long serialVersionUID = 1L;

    public KeyValueRecord(String key, String value) {
        super(key, value);
        Objects.requireNonNull(key);
    }

    public KeyValueRecord(String category, Long recordId, String key, String value) {
        super(category, recordId, key, value);
        Objects.requireNonNull(key);
    }

    @Override
    public KeyValueRecord newValueRecord(String value) {
        return new KeyValueRecord(getCategory(), getRecordId(), getValueOfKeyField(), value);
    }

    @Override
    public final Field getKeyField() {
        return getFirstField();
    }

    @Override
    public final Field getValueField() {
        return getSecondField();
    }

    @Override
    public String toString() {
        return "KeyValueRecord{" +
                "category=" + getCategory() +
                ", recordId=" + getRecordId() +
                ", key=" + getFirstField().getValue() +
                ", value=" + getSecondField().getValue() +
                '}';
    }
}

@@ -358,37 +358,16 @@
   super(
-key, value);%0A        
 Objects.
@@ -377,32 +377,40 @@
 uireNonNull(key)
+, value)
 ;%0A    %7D%0A%0A    pub
@@ -525,29 +525,8 @@
 dId,
- key, value);%0A       
  Obj
@@ -549,16 +549,24 @@
 ull(key)
+, value)
 ;%0A    %7D%0A

Optimize constructors