Package org.spincast.core.utils
Class SpincastStatics
java.lang.Object
org.spincast.core.utils.SpincastStatics
Some few static methods.
You can still change the underlying instance though, in case
you need to change/fix something.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseQuietly(Closeable closeable) static voidcloseQuietly(InputStream stream) static voidcloseQuietly(OutputStream stream) static voidcloseQuietly(Reader reader) voidcloseQuietlyInstance(Closeable closeable) voidcloseQuietlyInstance(InputStream stream) voidcloseQuietlyInstance(OutputStream stream) voidcloseQuietlyInstance(Reader reader) getAllMethods(Class<?> clazz) Gets *all* the methods of a class for all visibilities and for all the parents hierarchy, even those fromObject.getAllMethods(Class<?> clazz, boolean includeJavaLangObjectMethods) Gets all the methods of a class, for all visibilities and for all the parents hierarchy.getAllMethodsInstance(Class<?> clazz, boolean includeJavaLangObjectMethods) protected static SpincastStaticsprotected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormatprotected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormatprotected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormatprotected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormatprotected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormatprotected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormatstatic org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormatstatic StringGets the stack trace of an Exception.protected Stringstatic LonglongValueOrNull(Object obj) Returnsnullif the specified object is null or usesLong.parseLong(String)otherwise, by casting the obj usingobj.toString()protected RuntimeExceptionReturnnullto continue the exception processing or an exception to be returned immediatly.static <K,V> Map<K, V> map(K key1, V value1) Creates a map.static <K,V> Map<K, V> map(K key1, V value1, K key2, V value2) Creates a map.static <K,V> Map<K, V> map(K key1, V value1, K key2, V value2, K key3, V value3) Creates a map.static <K,V> Map<K, V> map(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4) Creates a map.static <K,V> Map<K, V> map(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4, K key5, V value5) Creates a map.protected <K,V> Map<K, V> mapInstance(K key1, V value1) protected <K,V> Map<K, V> mapInstance(K key1, V value1, K key2, V value2) protected <K,V> Map<K, V> mapInstance(K key1, V value1, K key2, V value2, K key3, V value3) protected <K,V> Map<K, V> mapInstance(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4) protected <K,V> Map<K, V> mapInstance(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4, K key5, V value5) static voidmkDirsOrThrow(File dir) Create a directory and all its parents if required.voidCreates a Map<String, Object> map.Creates a Map<String, Object> map.Creates a Map<String, Object> map.params(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4) Creates a Map<String, Object> map.params(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5) Creates a Map<String, Object> map.static DateparseISO8601date(String str) Parse a ISO 8601 string representation of a date to a Date object.static RuntimeExceptionprotected RuntimeExceptionstatic voidsetInstance(SpincastStatics instance) static StringstringValueOrNull(Object obj) Returnsnullif the specified object is null or usesString.valueOf(Object)otherwise.static <T> T[]toArray(Collection<T> collection, Class<? super T> clazz) <T> T[]toArrayInstance(Collection<T> collection, Class<? super T> clazz) static <T> List<T>toList(T[] array, boolean emptyListIfNullArray) Converts an array to a mutable list.<T> List<T>toListInstance(T[] array, boolean emptyListIfNullArray)
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
SpincastStatics
public SpincastStatics()
-
-
Method Details
-
getInstance
-
setInstance
-
getIso8601DateParserDefault
public static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParserDefault() -
getIso8601DateParser1
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser1() -
getIso8601DateParser2
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser2() -
getIso8601DateParser3
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser3() -
getIso8601DateParser4
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser4() -
getIso8601DateParser5
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser5() -
getIso8601DateParser6
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser6() -
runtimize
-
runtimizePrivate
-
manageInterruptedException
Returnnullto continue the exception processing or an exception to be returned immediatly. -
getStackTrace
Gets the stack trace of an Exception. -
getStackTraceInstance
-
map
Creates a map. -
params
Creates a Map<String, Object> map. -
mapInstance
-
map
Creates a map. -
params
Creates a Map<String, Object> map. -
mapInstance
-
map
Creates a map. -
params
public static Map<String,Object> params(String key1, Object value1, String key2, Object value2, String key3, Object value3) Creates a Map<String, Object> map. -
mapInstance
-
map
public static <K,V> Map<K,V> map(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4) Creates a map. -
params
public static Map<String,Object> params(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4) Creates a Map<String, Object> map. -
mapInstance
protected <K,V> Map<K,V> mapInstance(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4) -
map
public static <K,V> Map<K,V> map(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4, K key5, V value5) Creates a map. -
params
public static Map<String,Object> params(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5) Creates a Map<String, Object> map. -
mapInstance
protected <K,V> Map<K,V> mapInstance(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4, K key5, V value5) -
getAllMethods
Gets *all* the methods of a class for all visibilities and for all the parents hierarchy, even those fromObject. -
getAllMethods
Gets all the methods of a class, for all visibilities and for all the parents hierarchy.- Parameters:
includeJavaLangObjectMethods- iffalse, methods fromObjectwill be excluded.
-
getAllMethodsInstance
-
parseISO8601date
Parse a ISO 8601 string representation of a date to a Date object. -
parseISO8601dateInstance
-
closeQuietly
-
closeQuietlyInstance
-
closeQuietly
-
closeQuietlyInstance
-
closeQuietly
-
closeQuietlyInstance
-
closeQuietly
-
closeQuietlyInstance
-
toArray
-
toArrayInstance
-
stringValueOrNull
Returnsnullif the specified object is null or usesString.valueOf(Object)otherwise. -
stringValueOrNullInstance
-
longValueOrNull
Returnsnullif the specified object is null or usesLong.parseLong(String)otherwise, by casting the obj usingobj.toString() -
longValueOrNullInstance
-
toList
Converts an array to a mutable list.The
Arrays.asList(Object...)method doesn't return a fully mutable list.- Parameters:
emptyListIfNullArray- iftrueand the specified array isnull, an empty list is returned. Iffalse,nullis returned.
-
toListInstance
-
mkDirsOrThrow
Create a directory and all its parents if required.- Throws:
ExecutionControl.RunException- if the directory can't be created.
-
mkDirsOrThrowInstance
-