Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Added the "Plc" prefix to the classnameclassnames.
  • I removed the datatype both from the properties as well as the generic type as I think type information - if needed - should be inside the query object.
  • For clarity reasons, I stripped the boilerplate: toString, equals, hashCode methods
  • PlcReadRequestItem no longer has a "size", as that's part of the query now. Some protocols ... such as Modbus (I think) ... don't support this concept.
  • NOTE: I would suggest to not remove PlcReadRequestItem class entirely, even if we could simply make PlcRequestItem non-abstract. For simplicity of the API I would opt for keeping it ... so we always have matching pairs of PlcXYZRequestItem and PlcXYZResponseItems.
  • (Eventually an Idea to define an Enum of operation types?!? ... then each item could return the operation-type)


Code Block
languagejava
package org.apache.plc4x.java.api.messages.items;

import org.apache.plc4x.java.api.types.ResponseCode;

import java.util.Objects;

public abstract class PlcResponseItem {

    private final PlcRequestItem requestItem;

    private final ResponseCode responseCode;

    public ResponseItem(PlcRequestItem requestItem, ResponseCode responseCode) {
        Objects.requireNonNull(requestItem,"Request item must not be null");
        Objects.requireNonNull(responseCode,"Response code must not be null");
        this.requestItem = requestItem;
        this.responseCode = responseCode;
    }

    public PlcRequestItem getRequestItem() {
        return requestItem;
    }

    public ResponseCode getResponseCode() {
        return responseCode;
    }

}

...