Package com.palmergames.util
Class JavaUtil
java.lang.Object
com.palmergames.util.JavaUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull UUID
changeUUIDVersion
(@NotNull UUID uuid, int version) static boolean
classExists
(@NotNull String className) static @Nullable MethodHandle
getFieldHandle
(@NotNull Class<?> clazz, @NotNull String fieldName) static @Nullable MethodHandle
getMethodHandle
(@NotNull Class<?> clazz, @NotNull String methodName) static @Nullable MethodHandle
getMethodHandle
(@NotNull Class<?> clazz, @NotNull String methodName, Class<?>... paramTypes) static @Nullable MethodHandle
getMethodHandle
(@NotNull String className, @NotNull String methodName) static boolean
isSubInterface
(Class<?> sup, Class<?> sub) Recursively check if the interface inherits the super interface.static <T> T
static <T> T
static @NotNull InputStream
readResource
(String resource) readTextFromJar
(String path) static void
saveResource
(String resource, Path destination, CopyOption... options)
-
Constructor Details
-
JavaUtil
public JavaUtil()
-
-
Method Details
-
isSubInterface
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
- Throws:
IOException
-
readResource
- Throws:
IOException
-
saveResource
public static void saveResource(String resource, Path destination, CopyOption... options) throws IOException - Throws:
IOException
-
classExists
-
make
-
make
-
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
-