From 079823cb904dcc25d0651fab914446f48cd859ed Mon Sep 17 00:00:00 2001 From: Joshua Shannon Date: Tue, 16 Jun 2020 16:52:29 -0600 Subject: [PATCH] Small changes to DataSource --- .../me/retrodaredevil/solarthing/DataSource.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/me/retrodaredevil/solarthing/DataSource.java b/core/src/main/java/me/retrodaredevil/solarthing/DataSource.java index 8f6819ba..7574b84c 100644 --- a/core/src/main/java/me/retrodaredevil/solarthing/DataSource.java +++ b/core/src/main/java/me/retrodaredevil/solarthing/DataSource.java @@ -1,6 +1,8 @@ package me.retrodaredevil.solarthing; +import me.retrodaredevil.solarthing.annotations.Nullable; + /** * A helper class to create and parse the source string */ @@ -8,19 +10,19 @@ public class DataSource { private final String sender; private final long dateMillis; private final String data; - + public DataSource(String sender, long dateMillis, String data) { this.sender = sender; this.dateMillis = dateMillis; this.data = data; } - + /** * NOTE: dateMillis has a radix of 16 while in string form * @param string The string representing the sender, dateMillis, and data * @return The {@link DataSource} represented by {@code string} or null */ - public static DataSource createFromStringOrNull(String string){ + public static @Nullable DataSource createFromStringOrNull(String string){ String[] split = string.split("\\|", 3); if(split.length != 3){ return null; @@ -36,12 +38,12 @@ public static DataSource createFromStringOrNull(String string){ } return new DataSource(sender, dateMillis, data); } - + @Override public String toString() { return sender + "|" + Long.toHexString(dateMillis) + "|" + data; } - + public String getSender() { return sender; }