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 Details

    • logger

      protected static final org.slf4j.Logger logger
  • Constructor Details

    • SpincastStatics

      public SpincastStatics()
  • Method Details

    • 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.
      See Also:
    • getStackTrace

      public static String getStackTrace(Throwable ex)
      Gets the stack trace of an Exception.
    • getStackTraceInstance

      protected String getStackTraceInstance(Throwable ex)
    • 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.
    • parseISO8601dateInstance

      public Date parseISO8601dateInstance(String str)
    • 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)
    • toArray

      public static <T> T[] toArray(Collection<T> collection, Class<? super T> clazz)
    • toArrayInstance

      public <T> T[] toArrayInstance(Collection<T> collection, Class<? super T> clazz)
    • stringValueOrNull

      public static String stringValueOrNull(Object obj)
      Returns null if the specified object is null or uses String.valueOf(Object) otherwise.
    • stringValueOrNullInstance

      public String stringValueOrNullInstance(Object obj)
    • 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()
    • longValueOrNullInstance

      public Long longValueOrNullInstance(Object obj)
    • toList

      public static <T> List<T> toList(T[] array, boolean emptyListIfNullArray)
      Converts an array to a mutable list.

      The Arrays.asList(Object...) method doesn't return a fully mutable list.

      Parameters:
      emptyListIfNullArray - if true and the specified array is null, an empty list is returned. If false, null is returned.
    • toListInstance

      public <T> List<T> toListInstance(T[] array, boolean emptyListIfNullArray)
    • mkDirsOrThrow

      public static void mkDirsOrThrow(File dir)
      Create a directory and all its parents if required.
      Throws:
      ExecutionControl.RunException - if the directory can't be created.
    • mkDirsOrThrowInstance

      public void mkDirsOrThrowInstance(File dir)