You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2017/04/06 22:58:28 UTC
svn commit: r1790479 -
/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
Author: ggregory
Date: Thu Apr 6 22:58:27 2017
New Revision: 1790479
URL: http://svn.apache.org/viewvc?rev=1790479&view=rev
Log:
Javadoc.
Modified:
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java?rev=1790479&r1=1790478&r2=1790479&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java Thu Apr 6 22:58:27 2017
@@ -45,6 +45,18 @@ public class TimeValue {
public static final TimeValue ZERO_MILLIS = new TimeValue(0, TimeUnit.MILLISECONDS);
public static final TimeValue NEG_ONE_SECONDS = new TimeValue(-1, TimeUnit.SECONDS);
+ /**
+ * Returns the given {@code long} value as an {@code int} where long values out of int range are returned as
+ * {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}.
+ *
+ * <p>
+ * For example: {@code TimeValue.asBoundInt(Long.MAX_VALUE)} returns {@code Integer.MAX_VALUE}.
+ * </p>
+ *
+ * @param value
+ * a long value to convert
+ * @return an int value bound within {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}.
+ */
public static int asBoundInt(final long value) {
if (value > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;