-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
17 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 1 addition & 39 deletions
40
sensor-data-bridge/src/main/java/nl/bertriksikken/loraforwarder/AppDeviceId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,9 @@ | ||
package nl.bertriksikken.loraforwarder; | ||
|
||
import java.util.Locale; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Combination of application name and device id that uniquely identifies a device.<br> | ||
* This class has a hashCode() and equals() implementation that allows it to be used in set and maps. | ||
*/ | ||
public final class AppDeviceId { | ||
|
||
private final String appName; | ||
private final String deviceId; | ||
public record AppDeviceId(String appName, String deviceId) { | ||
|
||
public AppDeviceId(String appName, String deviceId) { | ||
this.appName = appName; | ||
this.deviceId = deviceId; | ||
} | ||
|
||
public String getAppName() { | ||
return appName; | ||
} | ||
|
||
public String getDeviceId() { | ||
return deviceId; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object object) { | ||
if (object instanceof AppDeviceId) { | ||
AppDeviceId other = (AppDeviceId) object; | ||
return appName.equals(other.appName) && deviceId.equals(other.deviceId); | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(appName, deviceId); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format(Locale.ROOT, "%s/%s", appName, deviceId); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters