public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "AlarmName": return Optional.ofNullable(clazz.cast(alarmName())); case "Timestamp": return Optional.ofNullable(clazz.cast(timestamp())); case "HistoryItemType": return Optional.ofNullable(clazz.cast(historyItemTypeAsString())); case "HistorySummary": return Optional.ofNullable(clazz.cast(historySummary())); case "HistoryData": return Optional.ofNullable(clazz.cast(historyData())); default: return Optional.empty(); } }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("AlarmHistoryItem").add("AlarmName", alarmName()).add("Timestamp", timestamp()) .add("HistoryItemType", historyItemTypeAsString()).add("HistorySummary", historySummary()) .add("HistoryData", historyData()).build(); }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("AlarmHistoryItem").add("AlarmName", alarmName()).add("Timestamp", timestamp()) .add("HistoryItemType", historyItemTypeAsString()).add("HistorySummary", historySummary()) .add("HistoryData", historyData()).build(); }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(alarmName()); hashCode = 31 * hashCode + Objects.hashCode(timestamp()); hashCode = 31 * hashCode + Objects.hashCode(historyItemTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(historySummary()); hashCode = 31 * hashCode + Objects.hashCode(historyData()); return hashCode; }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(alarmName()); hashCode = 31 * hashCode + Objects.hashCode(timestamp()); hashCode = 31 * hashCode + Objects.hashCode(historyItemTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(historySummary()); hashCode = 31 * hashCode + Objects.hashCode(historyData()); return hashCode; }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "AlarmName": return Optional.ofNullable(clazz.cast(alarmName())); case "Timestamp": return Optional.ofNullable(clazz.cast(timestamp())); case "HistoryItemType": return Optional.ofNullable(clazz.cast(historyItemTypeAsString())); case "HistorySummary": return Optional.ofNullable(clazz.cast(historySummary())); case "HistoryData": return Optional.ofNullable(clazz.cast(historyData())); default: return Optional.empty(); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof AlarmHistoryItem)) { return false; } AlarmHistoryItem other = (AlarmHistoryItem) obj; return Objects.equals(alarmName(), other.alarmName()) && Objects.equals(timestamp(), other.timestamp()) && Objects.equals(historyItemTypeAsString(), other.historyItemTypeAsString()) && Objects.equals(historySummary(), other.historySummary()) && Objects.equals(historyData(), other.historyData()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof AlarmHistoryItem)) { return false; } AlarmHistoryItem other = (AlarmHistoryItem) obj; return Objects.equals(alarmName(), other.alarmName()) && Objects.equals(timestamp(), other.timestamp()) && Objects.equals(historyItemTypeAsString(), other.historyItemTypeAsString()) && Objects.equals(historySummary(), other.historySummary()) && Objects.equals(historyData(), other.historyData()); }