Package fmpp.util
Class MiscUtil
java.lang.Object
fmpp.util.MiscUtil
Miscellaneous utility methods.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]Concatenates two arrays.static StringThis is the same ascauseTrace(java.lang.Throwable), but it doesn't print the exception class name if the class is inside anfmpppackage.static StringReturns the cause trace of an exception.static voidcheckXmlSupportAvailability(String requiredForThis) Checks if XML API-s (JAXP, SAX2, DOM) are present.static ClassclassForName(String className) Tries to load the class with the current context class loader, and only then with the current defining class loader.static MapdictionaryToMap(Dictionary dict) static intfindObject(List list, Object o) Returns the first index of the given object (exactly the same instance) in the list.static Throwablestatic booleanlistContainsObject(List<?> list, Object o) Checks if the list contains the given object (exactly the same instance).static booleanmapContainsObject(Map<?, ?> map, Object o) Checks if the map contains the given object (exactly the same instance) as value.static intnumberToInt(Number value) Loseless convertion toint.
-
Field Details
-
EMPTY_CLASS_ARRAY
-
EMPTY_OBJECT_ARRAY
-
EMPTY_STRING_ARRAY
-
-
Constructor Details
-
MiscUtil
public MiscUtil()
-
-
Method Details
-
causeMessages
This is the same ascauseTrace(java.lang.Throwable), but it doesn't print the exception class name if the class is inside anfmpppackage. -
causeTrace
Returns the cause trace of an exception. This is similar to a J2SE 1.4+ stack-trace, but it's shorter, because it does not contain the "at" lines. -
classForName
Tries to load the class with the current context class loader, and only then with the current defining class loader.- Throws:
ClassNotFoundException
-
dictionaryToMap
-
getCauseException
-
listContainsObject
Checks if the list contains the given object (exactly the same instance). -
mapContainsObject
Checks if the map contains the given object (exactly the same instance) as value. -
findObject
Returns the first index of the given object (exactly the same instance) in the list.- Returns:
- the index of the first occurrence, or -1 if not found.
-
checkXmlSupportAvailability
Checks if XML API-s (JAXP, SAX2, DOM) are present. Can be a bit slow depending on the actual class loader setup.- Parameters:
requiredForThis- a short sentence that describes for human reader if for what do we need the XML support (e.g."Usage of xml data loader."or"Set XML entity resolver."). This sentence is used in error message of theInstallationException. Can benull.- Throws:
InstallationException
-
numberToInt
Loseless convertion toint.- Throws:
IllegalArgumentException- if the loseless conversion is not possible. The error message contains the details.
-
add
Concatenates two arrays.
-