|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.cloudera.api.ApiUtils
public final class ApiUtils
A collection of utility methods and common constants used by API code.
Field Summary | |
---|---|
static String |
DOT_SNAPSHOT_DIR
A special path component contained in the path for an HDFS snapshot dir. |
Method Summary | ||
---|---|---|
static
|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DOT_SNAPSHOT_DIR
Method Detail |
---|
public static org.joda.time.Instant newInstantFromString(String value)
public static Date newDateFromString(String value)
public static Date newDateFromMillis(long millis)
public static org.joda.time.Period newPeriodFromString(String value)
public static String printDate(Date date)
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 period
public 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |