public class Misc extends Object
Constructor and Description |
---|
Misc() |
Modifier and Type | Method and Description |
---|---|
static void |
addTo(Collection coll,
Object objToAdd)
Note if the passed object is a Colleciton itself or an Object[] it will be expanded
|
static Object[][] |
allocateArray(int rows,
int cols) |
static Map |
createCaseInsensitiveMap()
Create a case insenstive Tree Map.
|
static Map |
createConcurrentMap(int size)
Returns a ConcurrentHashMap if the jdk supports (1.5 or higher) it or else it returns a synchronized HashMap
|
static void |
disp(Object[][] data) |
static String |
getAsString(Object obj) |
static String |
getClassName(Object object)
Returns an Objects ClassName minus the package name
|
static String |
getDayOfWeek()
Get the day of week for today.
|
static String |
getDayOfWeek(Date date)
Return the day of week from the passed in Date.
|
static String |
getExceptionTrace(Throwable exception)
Return Exception information as a row (1 dim array)
|
static String |
getFormattedDate(String format,
Date date)
Formats the passed in date with the passed in date format String.
|
static String |
getFormattedDateNow(String format)
Formats todays date with the passed in date format String.
|
static String |
getMonth()
Return the 2 digit month of todays date
|
static String |
getMonth(Date date)
Get the month out of the passed in Date.
|
static String |
getShortDate()
Get the short date for Today.
|
static String |
getShortDate(Date date)
Get the short date for the passed in day.
|
static void |
isObjectString(Object arg) |
static Object[][] |
sort(Object[][] array,
int sortCol,
String sortOrder)
Sort a 2 dimensional array based on 1 columns data in either ascending or descending order.
|
static String[] |
trim(String[] array) |
public static String getClassName(Object object)
Sample Call:
String className=Misc.getClassName("My Object"); // returns "String"public static String getExceptionTrace(Throwable exception)
public static void addTo(Collection coll, Object objToAdd)
public static void isObjectString(Object arg)
public static Object[][] sort(Object[][] array, int sortCol, String sortOrder)
array
- - Array to be sortedsortCol
- - column to sort bysortOrder
- - sort the column in ascending or descending order. Valid arguments are "asc" and "desc".public static void disp(Object[][] data)
public static String[] trim(String[] array)
array
- array to do a string trim for all elementspublic static Object[][] allocateArray(int rows, int cols)
public static String getFormattedDateNow(String format)
public static String getFormattedDate(String format, Date date)
public static String getMonth(Date date)
public static String getMonth()
public static String getDayOfWeek(Date date)
public static String getDayOfWeek()
public static String getShortDate(Date date)
public static String getShortDate()
public static Map createCaseInsensitiveMap()
public static Map createConcurrentMap(int size)
Copyright © 2015. All rights reserved.