EPLHelpers.str() now takes varargs

This commit is contained in:
2018-11-14 18:29:25 -08:00
parent 22a4a76561
commit 36cefa32e6

View File

@ -1,3 +1,5 @@
import java.util.StringJoiner;
import org.joda.time.DateTime;
import org.joda.time.DateTimeComparator;
import org.joda.time.format.DateTimeFormat;
@ -14,6 +16,17 @@ public class EPLHelpers {
private static DateTimeComparator timeComparator = DateTimeComparator.getTimeOnlyInstance();
/**
* A simple toString() wrapper.
*/
public static String str(Object... objects) {
StringJoiner sj = new StringJoiner(", ");
for (Object o : objects) {
sj.add(o != null ? o.toString() : "null");
}
return sj.toString();
}
/**
* Return a DateTime object for the time. Should be specified in
* 24-hour "hh:mm" format.
@ -22,8 +35,6 @@ public class EPLHelpers {
return timeFormatter.parseDateTime(time);
}
/** A simple toString() wrapper for use in epl. */
public static String str(Object o) { return o.toString(); }
/**
* Return true if the time portion of 'now' is between the time
* portion of 'start' and 'end'.