Class Utils

java.lang.Object
dev.netcode.util.Utils

public class Utils extends Object
This class contains some different functions so that you dont need to implement them
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    This function returns the name of the class that contained the function that called this function (think about it. it makes sense).
    static String
    getCaller​(int offset)
    This function returns the name of the class that contained the function that called this function (think about it. it makes sense).
    static String
     
    static String
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • getTime

      public static String getTime()
      Returns:
      current time in HH:mm:ss format (e.g. 17:59:38)
    • getDate

      public static String getDate()
      Returns:
      current date in d.MM.YYYY format (e.g. 21.01.2021)
    • getCaller

      public static String getCaller() throws ClassNotFoundException
      This function returns the name of the class that contained the function that called this function (think about it. it makes sense). That way you can find out which class called a specific function.
      Returns:
      the caller of the function that called this function
      Throws:
      ClassNotFoundException - shouldn't really be thrown
    • getCaller

      public static String getCaller(int offset) throws ClassNotFoundException
      This function returns the name of the class that contained the function that called this function (think about it. it makes sense). That way you can find out which class called a specific function.
      Parameters:
      offset - to add to the stack trace if it was passed through any other class
      Returns:
      the name of the calling class
      Throws:
      ClassNotFoundException - shouldn't really be thrown