org.bidib.wizard.model.dmx.DmxChannelWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bidibwizard-model Show documentation
Show all versions of bidibwizard-model Show documentation
jBiDiB BiDiB Wizard Model POM
package org.bidib.wizard.model.dmx;
import java.util.Objects;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.jgoodies.binding.beans.Model;
public final class DmxChannelWrapper extends Model {
private static final long serialVersionUID = 1L;
public static final String PROPERTY_DMX_CHANNEL_ID = "dmxChannelId";
private Integer dmxChannelId;
private final int cvNumber;
public DmxChannelWrapper(Integer dmxChannelId, int cvNumber) {
this.dmxChannelId = dmxChannelId;
this.cvNumber = cvNumber;
}
public int getCvNumber() {
return cvNumber;
}
public Integer getDmxChannelId() {
return dmxChannelId;
}
public void setDmxChannelId(Integer dmxChannelId) {
Integer oldValue = this.dmxChannelId;
this.dmxChannelId = dmxChannelId;
firePropertyChange(PROPERTY_DMX_CHANNEL_ID, oldValue, this.dmxChannelId);
}
@Override
public int hashCode() {
return Objects.hash(cvNumber, dmxChannelId);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DmxChannelWrapper other = (DmxChannelWrapper) obj;
return cvNumber == other.cvNumber && Objects.equals(dmxChannelId, other.dmxChannelId);
}
public static DmxChannelWrapper searchKey(Integer dmxChannelId) {
return new DmxChannelWrapper(dmxChannelId, -1);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}