package com.battery.device.api.model; import java.util.Objects; public record ChannelIdentity( String adapterCode, int devtype, int devid, int subdevid, int chlid) { public ChannelIdentity { adapterCode = Objects.requireNonNull(adapterCode, "adapterCode").trim(); if (adapterCode.isEmpty()) throw new IllegalArgumentException("adapterCode must not be blank"); if (devtype < 0 || devid < 0 || subdevid < 0 || chlid < 0) throw new IllegalArgumentException("BTS channel identity values must be non-negative"); } /** 返回不含适配器实例的厂商通道键,由设备类型、设备号、单元号和通道号拼成。 */ public String vendorKey() { return devtype + "-" + devid + "-" + subdevid + "-" + chlid; } }