|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcakoose.util.LangUtil
public class LangUtil
| Constructor Summary | |
|---|---|
LangUtil()
|
|
| Method Summary | ||
|---|---|---|
static
|
A(T... elements)
Returns the given list of values as an array. |
|
static void |
assertBadType(Object o)
|
|
static AssertionError |
badType(Enum<?> e)
|
|
static AssertionError |
badType(Object o)
Returns an AssertionError with a helpful message about what the type of the given object is. |
|
static
|
cast(T value)
|
|
static boolean |
eq(Object a,
Object b)
Similar to "a.equals(b)" except it works when either value is null. |
|
static RuntimeException |
todo()
Returns: new RuntimeException("todo"). |
|
static RuntimeException |
todo(String s)
Returns: new RuntimeException("todo: " + s). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LangUtil()
| Method Detail |
|---|
public static AssertionError badType(Object o)
Returns an AssertionError with a helpful message about what the type of the given object is. Example use:
if (e instanceof BinaryOp) {
BinaryOp b = (BinaryOp) e;
...
} else if (e instanceof Literal) {
Literal l = (Literal) e;
...
} else {
throw badType(e);
}
public static AssertionError badType(Enum<?> e)
public static void assertBadType(Object o)
public static <T,R> R cast(T value)
public static <T> T[] A(T... elements)
Returns the given list of values as an array.
Example: String[] args = A("java", "-jar", "HelloWorld.jar")
public static RuntimeException todo()
Returns: new RuntimeException("todo").
Example: throw todo().
public static RuntimeException todo(String s)
Returns: new RuntimeException("todo: " + s).
Example: throw todo("error handling").
public static boolean eq(Object a,
Object b)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||