berlin.yuna.survey.logic.CommonUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of surveys Show documentation
Show all versions of surveys Show documentation
Survey is a plain java library to provide a base for surveys / questionnaires. It also provides a
function to generate diagrams and to measure answer times.
The newest version!
package berlin.yuna.survey.logic;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Optional;
import static java.time.LocalDateTime.now;
public class CommonUtils {
private CommonUtils() {
}
public static boolean hasText(final Object string) {
return toText(string).isPresent();
}
public static Optional toText(final Object string) {
return string instanceof String && ((String) string).trim().length() > 0 ? Optional.of((String) string) : Optional.empty();
}
public static LocalDateTime getTime() {
return now(ZoneId.of("UTC"));
}
}