public final class ApiUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
baseEquals(T object,
Object other)
Checks whether the other object has the same class as the given
object, and casts it to the given object's type.
|
static void |
checkOffsetAndLimit(int offset,
int limit)
Check that the given values are sane.
|
static Date |
getFromDate(String fromString,
Date toDate,
org.joda.time.Duration window)
Calculate the fromDate.
|
static Date |
newDateFromMillis(long millis) |
static Date |
newDateFromString(String value) |
static org.joda.time.Instant |
newInstantFromString(String value) |
static org.joda.time.Period |
newPeriodFromString(String value) |
static String |
printDate(Date date) |
public static org.joda.time.Instant newInstantFromString(String value)
public static Date newDateFromMillis(long millis)
public static org.joda.time.Period newPeriodFromString(String value)
public static Date getFromDate(String fromString, Date toDate, org.joda.time.Duration window)
fromString
- A string representation of the from date.toDate
- The to date for this periodwindow
- The duration of this periodpublic static <T> T baseEquals(T object, Object other)
The pattern for using this in an implementation of equals() would be:
MyType that = ApiUtils.baseEquals(this, other); return this == that || (that != null && Objects.equal(...) && Objects.equal(...));
object
- The object being compared.other
- The object being compared against.public static void checkOffsetAndLimit(int offset, int limit)
offset
- Value to use as offset of a list.limit
- Value to use as limit of a list's size.IllegalArgumentException
- If values are not ok.Copyright © Cloudera, Inc. Released under Apache License, Version 2.0.