Class JavaUtil

java.lang.Object
com.palmergames.util.JavaUtil

public class JavaUtil extends Object
  • Constructor Details

    • JavaUtil

      public JavaUtil()
  • Method Details

    • isSubInterface

      public static boolean isSubInterface(Class<?> sup, Class<?> sub)
      Recursively check if the interface inherits the super interface. Returns false if not an interface. Returns true if sup = sub.
      Parameters:
      sup - The class of the interface you think it is a subinterface of.
      sub - The possible subinterface of the super interface.
      Returns:
      true if it is a subinterface.
    • readTextFromJar

      public static List<String> readTextFromJar(String path) throws IOException
      Throws:
      IOException
    • readResource

      @NotNull public static @NotNull InputStream readResource(String resource) throws IOException
      Throws:
      IOException
    • saveResource

      public static void saveResource(String resource, Path destination, CopyOption... options) throws IOException
      Throws:
      IOException
    • classExists

      public static boolean classExists(@NotNull @NotNull String className)
    • make

      public static <T> T make(Supplier<T> supplier)
    • make

      public static <T> T make(T initial, Consumer<T> initializer)
    • getMethodHandle

      @Nullable public static @Nullable MethodHandle getMethodHandle(@NotNull @NotNull String className, @NotNull @NotNull String methodName)
    • getMethodHandle

      @Nullable public static @Nullable MethodHandle getMethodHandle(@NotNull @NotNull Class<?> clazz, @NotNull @NotNull String methodName)
    • getMethodHandle

      @Nullable public static @Nullable MethodHandle getMethodHandle(@NotNull @NotNull Class<?> clazz, @NotNull @NotNull String methodName, Class<?>... paramTypes)
    • getFieldHandle

      @Nullable public static @Nullable MethodHandle getFieldHandle(@NotNull @NotNull Class<?> clazz, @NotNull @NotNull String fieldName)
    • changeUUIDVersion

      @NotNull @Contract(pure=true) public static @NotNull UUID changeUUIDVersion(@NotNull @NotNull UUID uuid, int version)