public final class ApiUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DOT_SNAPSHOT_DIR
A special path component contained in the path for an HDFS snapshot dir.
|
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 |
checkLimit(int limit)
Check that the given limit is positive.
|
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) |
static String |
printDate(org.joda.time.Instant instant) |
public static final String DOT_SNAPSHOT_DIR
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 String printDate(org.joda.time.Instant instant)
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.public static void checkLimit(int limit)
limit
- Value to use as limit of a list's size.Copyright © Cloudera, Inc. Released under Apache License, Version 2.0.