public.javadoc.org.spincast.core.utils.SpincastStatics.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
SpincastStatics (org.spincast:spincast-framework 1.0.0 API)
org.spincast.core.utils
Class SpincastStatics
- java.lang.Object
-
- org.spincast.core.utils.SpincastStatics
-
public class SpincastStatics
extends Object
Some few static methods.
You can still change the underlying instance though, in case
you need to change/fix something.
-
-
Field Summary
Fields
Modifier and Type
Field and Description
protected static org.slf4j.Logger
logger
-
Constructor Summary
Constructors
Constructor and Description
SpincastStatics()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
static 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)
static Set<Method>
getAllMethods(Class<?> clazz)
Gets *all* the methods of a class for all visibilities
and for all the parents hierarchy, even those from
Object
.
static Set<Method>
getAllMethods(Class<?> clazz,
boolean includeJavaLangObjectMethods)
Gets all the methods of a class, for all visibilities
and for all the parents hierarchy.
protected Set<Method>
getAllMethodsInstance(Class<?> clazz,
boolean includeJavaLangObjectMethods)
protected static SpincastStatics
getInstance()
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
getIso8601DateParser1()
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
getIso8601DateParser2()
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
getIso8601DateParser3()
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
getIso8601DateParser4()
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
getIso8601DateParser5()
protected static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
getIso8601DateParser6()
static org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat
getIso8601DateParserDefault()
static String
getStackTrace(Throwable ex)
Gets the stack trace of an Exception.
protected String
getStackTraceInstance(Throwable ex)
static Long
longValueOrNull(Object obj)
Returns null
if the specified object
is null or uses Long.parseLong(String)
otherwise,
by casting the obj using obj.toString()
Long
longValueOrNullInstance(Object obj)
protected RuntimeException
manageInterruptedException(Exception ex)
Return null
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 Map<String,Object>
params(String key1,
Object value1)
Creates a Map<String, Object> map.
static Map<String,Object>
params(String key1,
Object value1,
String key2,
Object value2)
Creates a Map<String, Object> map.
static Map<String,Object>
params(String key1,
Object value1,
String key2,
Object value2,
String key3,
Object value3)
Creates a Map<String, Object> map.
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.
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.
static Date
parseISO8601date(String str)
Parse a ISO 8601 string representation of a date
to a Date object.
Date
parseISO8601dateInstance(String str)
static RuntimeException
runtimize(Exception ex)
protected RuntimeException
runtimizePrivate(Exception ex)
static void
setInstance(SpincastStatics instance)
static String
stringValueOrNull(Object obj)
Returns null
if the specified object
is null or uses String.valueOf(Object)
otherwise.
String
stringValueOrNullInstance(Object obj)
static <T> T[]
toArray(Set<T> set,
Class<? super T> clazz)
<T> T[]
toArrayInstance(Set<T> set,
Class<? super T> clazz)
-
-
Method Detail
-
getInstance
protected static SpincastStatics getInstance()
-
setInstance
public static void setInstance(SpincastStatics instance)
-
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
public static RuntimeException runtimize(Exception ex)
-
runtimizePrivate
protected RuntimeException runtimizePrivate(Exception ex)
-
manageInterruptedException
protected RuntimeException manageInterruptedException(Exception ex)
Return null
to continue the exception processing or
an exception to be returned immediatly.
-
getStackTrace
public static String getStackTrace(Throwable ex)
Gets the stack trace of an Exception.
-
map
public static <K,V> Map<K,V> map(K key1,
V value1)
Creates a map.
-
params
public static Map<String,Object> params(String key1,
Object value1)
Creates a Map<String, Object> map.
-
mapInstance
protected <K,V> Map<K,V> mapInstance(K key1,
V value1)
-
map
public static <K,V> Map<K,V> map(K key1,
V value1,
K key2,
V value2)
Creates a map.
-
params
public static Map<String,Object> params(String key1,
Object value1,
String key2,
Object value2)
Creates a Map<String, Object> map.
-
mapInstance
protected <K,V> Map<K,V> mapInstance(K key1,
V value1,
K key2,
V value2)
-
map
public static <K,V> Map<K,V> map(K key1,
V value1,
K key2,
V value2,
K key3,
V value3)
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
protected <K,V> Map<K,V> mapInstance(K key1,
V value1,
K key2,
V value2,
K key3,
V value3)
-
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
public static Set<Method> getAllMethods(Class<?> clazz)
Gets *all* the methods of a class for all visibilities
and for all the parents hierarchy, even those from
Object
.
-
getAllMethods
public static Set<Method> getAllMethods(Class<?> clazz,
boolean includeJavaLangObjectMethods)
Gets all the methods of a class, for all visibilities
and for all the parents hierarchy.
- Parameters:
includeJavaLangObjectMethods
- if false
,
methods from Object
will be excluded.
-
getAllMethodsInstance
protected Set<Method> getAllMethodsInstance(Class<?> clazz,
boolean includeJavaLangObjectMethods)
-
parseISO8601date
public static Date parseISO8601date(String str)
Parse a ISO 8601 string representation of a date
to a Date object.
-
closeQuietly
public static void closeQuietly(InputStream stream)
-
closeQuietlyInstance
public void closeQuietlyInstance(InputStream stream)
-
closeQuietly
public static void closeQuietly(OutputStream stream)
-
closeQuietlyInstance
public void closeQuietlyInstance(OutputStream stream)
-
closeQuietly
public static void closeQuietly(Reader reader)
-
closeQuietlyInstance
public void closeQuietlyInstance(Reader reader)
-
closeQuietly
public static void closeQuietly(Closeable closeable)
-
closeQuietlyInstance
public void closeQuietlyInstance(Closeable closeable)
-
stringValueOrNull
public static String stringValueOrNull(Object obj)
Returns null
if the specified object
is null or uses String.valueOf(Object)
otherwise.
-
longValueOrNull
public static Long longValueOrNull(Object obj)
Returns null
if the specified object
is null or uses Long.parseLong(String)
otherwise,
by casting the obj using obj.toString()
Copyright © 2019. All rights reserved.