Class AlarmEqualityChecker
- java.lang.Object
-
- org.opennms.features.kafka.producer.AlarmEqualityChecker
-
public class AlarmEqualityChecker extends java.lang.Object
Checks equality between two alarms based on a defined set of excluded fields.Equality methods in this class modify their parameters as a side effect of comparison (by clearing certain fields). This is done to avoid needlessly cloning parameters by default. If modification is undesirable the parameters must be cloned before being passed to this class and discarded afterwards.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AlarmEqualityChecker.Exclusions
Static class to namespace a predefined set of exclusions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equalsExcludingOnBoth(OpennmsModelProtos.Alarm.Builder a, OpennmsModelProtos.Alarm.Builder b)
Checks two given alarms for equality excluding a defined set of fields during the equality check.boolean
equalsExcludingOnFirst(OpennmsModelProtos.Alarm.Builder a, OpennmsModelProtos.Alarm b)
Checks two given alarms for equality excluding a defined set of fields on alarm a during the equality check.static AlarmEqualityChecker
with(java.util.function.Function<OpennmsModelProtos.Alarm.Builder,OpennmsModelProtos.Alarm.Builder> applyExclusions)
Static factory method.
-
-
-
Method Detail
-
with
public static AlarmEqualityChecker with(java.util.function.Function<OpennmsModelProtos.Alarm.Builder,OpennmsModelProtos.Alarm.Builder> applyExclusions)
Static factory method.- Parameters:
applyExclusions
- exclusion function- Returns:
- the instance with the given exclusion function
-
equalsExcludingOnBoth
public boolean equalsExcludingOnBoth(OpennmsModelProtos.Alarm.Builder a, OpennmsModelProtos.Alarm.Builder b)
Checks two given alarms for equality excluding a defined set of fields during the equality check.- Parameters:
a
- alarm ab
- alarm b- Returns:
- true if equal, false otherwise
-
equalsExcludingOnFirst
public boolean equalsExcludingOnFirst(OpennmsModelProtos.Alarm.Builder a, OpennmsModelProtos.Alarm b)
Checks two given alarms for equality excluding a defined set of fields on alarm a during the equality check.- Parameters:
a
- alarm a which will have exclusions appliedb
- alarm b- Returns:
- true if equal, false otherwise
-
-