|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sibvisions.util.type.CommonUtil
public final class CommonUtil
The CommonUtil contains utility methods for handling
type independent operations.
| Method Summary | ||
|---|---|---|
static
|
close(Object... pClosable)
Close the given object(s) if closable. |
|
static boolean |
containsException(Throwable pCause,
Class<?> pClass)
Gets whether an exception chain is or contains a specific error class. |
|
static String |
dump(Throwable pCause,
boolean pDeep)
Writes the stack trace of an exception/throwable object into a string. |
|
static boolean |
equals(Object pFirst,
Object pSecond)
Indicates whether two object are "equal". |
|
static List<Throwable> |
getCauseList(Throwable pCause)
Gets the list of all available exceptions. |
|
static Throwable |
getException(Throwable pCause,
Class<?> pClass)
Gets an exception of the given type from an exception chain. |
|
static Throwable |
getFirstCause(Throwable pCause)
Gets the first cause. |
|
static int |
getFreePort(int pMin,
int pMax)
Searchs a free *network* port in the given range. |
|
static int |
getFreePort(int pMin,
int pMax,
boolean pCheckLocal)
Searchs a free port in the given range. |
|
static boolean |
isReachable(String pHost,
int pPort)
Tests if the given port is reachable on the given host. |
|
static
|
nvl(T pValue,
T pNvlValue)
Gets an alternative value for a null object. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String dump(Throwable pCause,
boolean pDeep)
pCause - Exception/Throwable (StackTrace)pDeep - true to dump the trace with all causes; false to dump
only the exception
public static Throwable getFirstCause(Throwable pCause)
pCause - the origin cause
public static List<Throwable> getCauseList(Throwable pCause)
pCause - the start exception
public static boolean containsException(Throwable pCause,
Class<?> pClass)
pCause - the exception (chain)pClass - the expected class
true if the given class or a sub class was found in the exception
chain, false otherwiseClass.isAssignableFrom(Class)
public static Throwable getException(Throwable pCause,
Class<?> pClass)
pCause - the exception (chain)pClass - the expected class
null if no exception with the given type was foundClass.isAssignableFrom(Class)
public static <T> T nvl(T pValue,
T pNvlValue)
null object.
T - parameter typepValue - desired valuepNvlValue - alternative value
pValue or pNvlValue if pValue == null
public static boolean equals(Object pFirst,
Object pSecond)
null or
the Object.equals(Object) returns true.
pFirst - an objectpSecond - another object
true if both objects are equal
public static int getFreePort(int pMin,
int pMax)
pMin - the min portpMax - the max port
public static int getFreePort(int pMin,
int pMax,
boolean pCheckLocal)
pMin - the min portpMax - the max portpCheckLocal - true to check local (127.0.0.1) interface as well as network interface (0.0.0.0),
false to check only the network interface
public static boolean isReachable(String pHost,
int pPort)
pHost - the hostname or IPpPort - th port number
true if the port is reachable, false otherwisepublic static <T> T close(Object... pClosable)
T - the closable typepClosable - the object(s) to close
null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||