Here you can find the source of getTimeUnit(Object units)
public static TimeUnit getTimeUnit(Object units)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.TimeUnit; public class Main { private static final String EVENTS_DELIMITER = "EVENTS/"; public static TimeUnit getTimeUnit(Object units) { if (units instanceof TimeUnit) { return (TimeUnit) units; } else if (units instanceof String) { return cleanUnitsString((String) units); }/*from w w w .j a v a 2 s. c o m*/ throw new IllegalArgumentException("unable to parse returned time units: " + units.toString()); } public static TimeUnit cleanUnitsString(String units) { if (units == null) { return TimeUnit.SECONDS; } units = units.toUpperCase(); if (units.contains(EVENTS_DELIMITER)) { units = units.substring(EVENTS_DELIMITER.length()); units += "S"; } return TimeUnit.valueOf(units); } }