001package jmri.util; 002 003import java.util.Objects; 004import javax.annotation.Nonnull; 005import jmri.NamedBean; 006 007/** 008 * Retain a NamedBean and its expected state. 009 * 010 * @author Randall Wood Copyright 2017 011 * @param <T> the supported type of NamedBean 012 */ 013public class NamedBeanExpectedState<T extends NamedBean> extends NamedBeanExpectedValue<T, Integer> { 014 015 public NamedBeanExpectedState(@Nonnull T bean, @Nonnull String name, @Nonnull Integer state) { 016 super(bean, name, state); 017 Objects.requireNonNull(state, "state Integer must not be null"); 018 } 019 020 public NamedBeanExpectedState(@Nonnull T bean, @Nonnull Integer state) { 021 this(bean, bean.getDisplayName(), state); 022 } 023 024 /** 025 * {@inheritDoc} 026 * <p> 027 * This implementation requires a non-null parameter. 028 * 029 * @throws NullPointerException if state is null 030 */ 031 @Override 032 public void setExpectedState(@Nonnull Integer state) { 033 Objects.requireNonNull(state, "state Integer must not be null"); 034 super.setExpectedState(state); 035 } 036}