Skip to content

Commit

Permalink
fix(plc4j/spi): implement unknown field
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Oct 8, 2021
1 parent 9d0a0e4 commit d109d44
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ public class FieldReaderUnknown<T> implements FieldReader<T> {

@Override
public T readField(String logicalName, DataReader<T> dataReader, WithReaderArgs... readerArgs) throws ParseException {
return switchByteOrderIfNecessary(() -> dataReader.read(logicalName, readerArgs), dataReader, extractByteOder(readerArgs).orElse(null));
throw new IllegalStateException("not possible with unknown field");
}

public void readUnknownField(String logicalName, DataReader<T> dataReader, WithReaderArgs... readerArgs) throws ParseException {
T unknownValue = dataReader.read(logicalName, readerArgs);
LOGGER.debug("Read unkown value {}", unknownValue);
}

}

0 comments on commit d109d44

Please sign in to comment.