*
* @author Thomas Pantelis
*/
-public class CarEntryDataTreeCommitCohort implements DOMDataTreeCommitCohort {
+public final class CarEntryDataTreeCommitCohort implements DOMDataTreeCommitCohort {
private static final Logger LOG = LoggerFactory.getLogger(CarEntryDataTreeCommitCohort.class);
private static final QName YEAR_QNAME = QName.create(Cars.QNAME, "year").intern();
// ModificationType because dataAfter will not be present. Also dataAfter *should* always contain a
// MapEntryNode but we verify anyway.
if (dataAfter.isPresent()) {
- final NormalizedNode normalizedNode = dataAfter.get();
+ final NormalizedNode normalizedNode = dataAfter.orElseThrow();
Verify.verify(normalizedNode instanceof DataContainerNode,
"Expected type DataContainerNode, actual was %s", normalizedNode.getClass());
DataContainerNode entryNode = (DataContainerNode) normalizedNode;
final Optional<DataContainerChild> possibleYear = entryNode.findChildByArg(YEAR_NODE_ID);
if (possibleYear.isPresent()) {
- final Number year = (Number) possibleYear.get().body();
+ final Number year = (Number) possibleYear.orElseThrow().body();
LOG.info("year is {}", year);