Due to a ransomware attack, the wiki was reverted to a July 2022 version. . We apologize for the lack of a more recent valid backup.
...
Checking for null method inputs - using checkNotNull():
Code Block language java import static com.google.common.base.Preconditions.checkNotNull; ... @Override public void removeDevice(DeviceId deviceId) { checkNotNull(deviceId, DEVICE_ID_NULL); DeviceEvent event = store.removeDevice(deviceId); if (event != null) { log.info("Device {} administratively removed", deviceId); post(event); } }
toString() - ToStringHelper():
Code Block language java import static com.google.common.base.MoreObjects.toStringHelper; ... @Override public String toString() { return toStringHelper(this) .add("id", id) .add("vlan", vlan) .add("ipAddresses", ips) .toString(); }
- Data structures such as
Lists
,ImmutableSet
, andHashMultiMap
Unit testing - EqualsTester():
Code Block language java import com.google.common.testing.EqualsTester; ... VlanId vlan1 = VlanId.vlanId((short) -1); VlanId vlan2 = VlanId.vlanId((short) 100); VlanId vlan3 = VlanId.vlanId((short) 100); // first two equality groups contain equal objects, last differs // from constituents of first two groups new EqualsTester().addEqualityGroup(VlanId.vlanId(), vlan1) .addEqualityGroup(vlan2, vlan3) .addEqualityGroup(VlanId.vlanId((short) 10));
...
Home : Contributing to the ONOS Codebase
...