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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
closeQuietly
(Closeable closeable) static void
closeQuietly
(InputStream stream) static void
closeQuietly
(OutputStream stream) static void
closeQuietly
(Reader reader) void
closeQuietlyInstance
(Closeable closeable) void
closeQuietlyInstance
(InputStream stream) void
closeQuietlyInstance
(OutputStream stream) void
closeQuietlyInstance
(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 SpincastStatics
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
static String
Gets the stack trace of an Exception.protected String
static Long
longValueOrNull
(Object obj) Returnsnull
if the specified object is null or usesLong.parseLong(String)
otherwise, by casting the obj usingobj.toString()
protected RuntimeException
Returnnull
to 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 void
mkDirsOrThrow
(File dir) Create a directory and all its parents if required.void
Creates 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 Date
parseISO8601date
(String str) Parse a ISO 8601 string representation of a date to a Date object.static RuntimeException
protected RuntimeException
static void
setInstance
(SpincastStatics instance) static String
stringValueOrNull
(Object obj) Returnsnull
if 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
Returnnull
to 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 fromObject
will 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
Returnsnull
if the specified object is null or usesString.valueOf(Object)
otherwise. -
stringValueOrNullInstance
-
longValueOrNull
Returnsnull
if 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
- iftrue
and the specified array isnull
, an empty list is returned. Iffalse
,null
is returned.
-
toListInstance
-
mkDirsOrThrow
Create a directory and all its parents if required.- Throws:
ExecutionControl.RunException
- if the directory can't be created.
-
mkDirsOrThrowInstance
-