Class JK

java.lang.Object
com.jk.core.util.JK

public class JK extends Object
The Class JK.
  • Field Details

    • NEW_LINE

      public static final String NEW_LINE
      The Constant NEW_LINE.
    • FIELD_SEPARATOR

      public static final String FIELD_SEPARATOR
      The Constant FIELD_SEPARATOR.
      See Also:
    • CSV_SEPARATOR

      public static final String CSV_SEPARATOR
      The Constant CSV_SEPARATOR.
      See Also:
    • FILE_SEPRATOR

      public static final String FILE_SEPRATOR
      The Constant FILE_SEPRATOR.
    • DEFAULT_LOCALE

      public static JKLocale DEFAULT_LOCALE
      The default locale.
  • Constructor Details

    • JK

      public JK()
  • Method Details

    • debug

      public static void debug()
      Debug.
    • error

      public static void error(String format, Object... params)
      Error.
      Parameters:
      format - the format
      params - the params
    • print

      public static void print(Object... params)
      Prints the.
      Parameters:
      params - the params
    • print

      public static void print(Map prop)
      Prints the.
      Parameters:
      prop - the prop
    • print

      public static void print(String name, List<?> list)
      Prints the.
      Parameters:
      name - the name
      list - the list
    • print

      public static void print(String name, Map<?,?> map)
      Prints the.
      Parameters:
      name - the name
      map - the map
    • buildToString

      public static String buildToString(Object... params)
      Builds the to string.
      Parameters:
      params - the params
      Returns:
      the string
    • concat

      public static String concat(Object... params)
      Concat.
      Parameters:
      params - the params
      Returns:
      the string
    • handle

      public static void handle(Throwable t)
      Handle.
      Parameters:
      t - the t
    • line

      public static void line()
      Line.
    • printBlock

      public static void printBlock(Object... params)
      Prints the block.
      Parameters:
      params - the params
    • throww

      public static RuntimeException throww(Throwable t)
      Throww.
      Parameters:
      t - the t
      Returns:
      the runtime exception
    • toMap

      public static Map toMap(Object[] keys, Object[] values)
      To map.
      Parameters:
      keys - the keys
      values - the values
      Returns:
      the map
    • main

      public static void main(String[] args)
      The main method.
      Parameters:
      args - the arguments
    • randomNumber

      public static int randomNumber()
      Random number.
      Returns:
      the int
    • randomNumber

      public static int randomNumber(int min, int max)
      Random number.
      Parameters:
      min - the min
      max - the max
      Returns:
      the int
    • getInputStream

      public static InputStream getInputStream(String fileName)
      Gets the input stream.
      Parameters:
      fileName - the file name
      Returns:
      the input stream
    • newInstance

      public static <T> T newInstance(String className)
      New instance.
      Type Parameters:
      T - the generic type
      Parameters:
      className - the class name
      Returns:
      the t
    • setDefaultLocale

      public static void setDefaultLocale(JKLocale locale)
      Sets the default locale.
      Parameters:
      locale - the new default locale
    • restart

      public static void restart()
      Restart.
    • exception

      public static void exception(String message)
      Exception.
      Parameters:
      message - the message
    • implementMe

      public static void implementMe()
      Implement me.
    • notNeededAnyMore

      public static void notNeededAnyMore()
      Not needed any more.
    • printStackTrace

      public static void printStackTrace()
      Prints the stack trace.
    • notNull

      public static void notNull(Object object)
      Not null.
      Parameters:
      object - the object
    • isDebugMode

      public static boolean isDebugMode()
      Checks if is debug mode.
      Returns:
      true, if is debug mode
    • log

      public static void log(String format, Object... values)
      Log.
      Parameters:
      format - the format
      values - the values
    • debug

      public static void debug(String format, Object... values)
      Debug.
      Parameters:
      format - the format
      values - the values
    • csv

      public static String csv(String... msgs)
      Csv.
      Parameters:
      msgs - the msgs
      Returns:
      the string
    • addToSystemConfig

      public static void addToSystemConfig(String prefix, Properties prop)
      Adds the to system config.
      Parameters:
      prefix - the prefix
      prop - the prop
    • readString

      public static String readString(String msg)
      Read string.
      Parameters:
      msg - the msg
      Returns:
      the string
    • getScanner

      protected static Scanner getScanner()
      Gets the scanner.
      Returns:
      the scanner
    • readPassword

      public static char[] readPassword(String msg)
      Read password.
      Parameters:
      msg - the msg
      Returns:
      the char[]
    • printOnce

      public static void printOnce(Object msg)
      Prints the once.
      Parameters:
      msg - the msg
    • getMessagesCache

      public static HashMap<Integer,Object> getMessagesCache()
      Gets the messages cache.
      Returns:
      the messages cache
    • fixMe

      public static void fixMe()
      Fix me.
    • fixMe

      public static void fixMe(String msg)
      Fix me.
      Parameters:
      msg - the msg
    • testMe

      public static void testMe()
      Test me.
    • testMe

      public static void testMe(String message)
      Test me.
      Parameters:
      message - the message
    • checkMe

      public static void checkMe()
      Check me.
    • getReader

      public static Reader getReader(String fileName)
      Gets the reader.
      Parameters:
      fileName - the file name
      Returns:
      the reader
    • getURL

      public static URL getURL(String path)
      Gets the url.
      Parameters:
      path - the path
      Returns:
      the url
    • exists

      public static boolean exists(String fileName)
      Exists.
      Parameters:
      fileName - the file name
      Returns:
      true, if successful
    • getAppName

      public static String getAppName()
      Gets the app name.
      Returns:
      the app name
    • throww

      public static void throww(Throwable e, String msg)
      Throww.
      Parameters:
      e - the e
      msg - the msg
    • close

      public static void close(InputStream in)
      Close.
      Parameters:
      in - the in
    • sleep

      public static void sleep(int millis)
      Sleep.
      Parameters:
      millis - the millis
    • implementMe

      public static void implementMe(String msg)
      Implement me.
      Parameters:
      msg - the msg
    • getWrapperForPrimitive

      public static Class<?> getWrapperForPrimitive(Class<?> clas)
      Gets the wrapper for primitive.
      Parameters:
      clas - the clas
      Returns:
      the wrapper for primitive
    • isPrimitive

      public static boolean isPrimitive(Class<?> type)
      Checks if is primitive.
      Parameters:
      type - the type
      Returns:
      true, if is primitive
    • type

      public static Class<?> type(String clasName)
      Type.
      Parameters:
      clasName - the clas name
      Returns:
      the class
    • getClass

      public static Class<?> getClass(String className)
      Gets the class.
      Parameters:
      className - the class name
      Returns:
      the class
    • newInstance

      public static <T> T newInstance(Class<T> class1)
      New instance.
      Type Parameters:
      T - the generic type
      Parameters:
      class1 - the class 1
      Returns:
      the t
    • isTestContext

      public static boolean isTestContext()
      Checks if is test context.
      Returns:
      true, if is test context
    • setTestContext

      public static void setTestContext()
      Sets the test context.
    • addToSystemConfig

      public static void addToSystemConfig(String generalSystemPropertiesPrefix, JKConfig prop)
      Adds the to system config.
      Parameters:
      generalSystemPropertiesPrefix - the general system properties prefix
      prop - the prop
    • toMap

      public static Map<String,Object> toMap(Object... list)
      To map.
      Parameters:
      list - the list
      Returns:
      the map
    • toList

      public static <T> List<T> toList(T... objects)
      To list.
      Type Parameters:
      T - the generic type
      Parameters:
      objects - the objects
      Returns:
      the list
    • isMultiTenantApp

      public static boolean isMultiTenantApp()
      Checks if is multi tenant app.
      Returns:
      true, if is multi tenant app
    • setMultiTenantApp

      public static void setMultiTenantApp(boolean multiTenantApp)
      Sets the multi tenant app.
      Parameters:
      multiTenantApp - the new multi tenant app
    • setAppName

      public static void setAppName(String appName)
      Sets the app name.
      Parameters:
      appName - the new app name
    • setDebugMode

      public static void setDebugMode(boolean debugMode)
      Sets the debug mode.
      Parameters:
      debugMode - the new debug mode
    • toSet

      public static Set<?> toSet(Object... obj)
      To set.
      Parameters:
      obj - the obj
      Returns:
      the sets the
    • init

      public static void init()
      Inits the.
    • initInfo

      protected static void initInfo()
      *.
    • newInstances

      public static <T> List<T> newInstances(Class<T> clas, int count)
      New instances.
      Type Parameters:
      T - the generic type
      Parameters:
      clas - the clas
      count - the count
      Returns:
      the list
    • first

      public static <T> T first(List<T> list)
      First.
      Type Parameters:
      T - the generic type
      Parameters:
      list - the list
      Returns:
      the t
    • getProperty

      public static String getProperty(String name)
      Gets the property.
      Parameters:
      name - the name
      Returns:
      the property
    • getProperty

      public static String getProperty(String name, String defaultValue)
      Gets the property.
      Parameters:
      name - the name
      defaultValue - the default value
      Returns:
      the property
    • getBuildTime

      public static String getBuildTime()
      Gets the builds the time.
      Returns:
      the builds the time
    • get

      public static String get()
      Gets the.
      Returns:
      the string
    • getLoadTime

      public static String getLoadTime()
      Gets the load time.
      Returns:
      the load time
    • runAsync

      public static void runAsync(Runnable runnable)
      Run async.
      Parameters:
      runnable - the runnable
    • toInt

      public static int toInt(Object obj)
      To int.
      Parameters:
      obj - the obj
      Returns:
      the int
    • getSize

      public static int getSize(Collection c)
      Gets the size.
      Parameters:
      c - the c
      Returns:
      the size