java.lang.Object
ushiosan.jvm_utilities.lang.Cls
Class containing helper methods for working with objects of type
Class-
Method Summary
Modifier and TypeMethodDescriptiongetArrayIndividualClass(T @NotNull [] array) Returns the class of the individual object in an array.getArrayIndividualClass(T @NotNull [] @NotNull [] array) Returns the class of the individual object in an array.Returns the class of the individual object in an array.static booleanisPrimitive(@NotNull Class<?> clazz) Checks whether the class of the argument is of some primitive type or some wrapper class corresponding to the primitive type.static booleanisPrimitive(@NotNull Object obj) Checks whether the class of the argument is of some primitive type or some wrapper class corresponding to the primitive type.static booleanisPrimitiveArray(@NotNull Class<?> clazz) Checks if the class of the argument is of some primitive type or some wrapper class corresponding to the primitive type (version for arrays).static booleanChecks if the class of the argument is of some primitive type or some wrapper class corresponding to the primitive type (version for arrays).toTypeArgs(Object @NotNull ... args) Returns the type of all data passed as arguments
-
Method Details
-
isPrimitive
Checks whether the class of the argument is of some primitive type or some wrapper class corresponding to the primitive type.- Parameters:
clazz- the class to inspect- Returns:
trueif the class is a primitive type orfalseotherwise
-
isPrimitive
Checks whether the class of the argument is of some primitive type or some wrapper class corresponding to the primitive type.- Parameters:
obj- the object to inspect- Returns:
trueif the class is a primitive type orfalseotherwise
-
isPrimitiveArray
Checks if the class of the argument is of some primitive type or some wrapper class corresponding to the primitive type (version for arrays).- Parameters:
clazz- the class to inspect- Returns:
trueif the class is a primitive type orfalseotherwise
-
isPrimitiveArray
Checks if the class of the argument is of some primitive type or some wrapper class corresponding to the primitive type (version for arrays).- Parameters:
obj- the object to inspect- Returns:
trueif the class is a primitive type orfalseotherwise
-
toTypeArgs
Returns the type of all data passed as arguments- Parameters:
args- the arguments to convert- Returns:
- an array with all element types
-
getArrayIndividualClass
Returns the class of the individual object in an array.Example:
String[] array = new String[] {"Hello", "World", "!"}; Class<?> cls = Cls.getArrayIndividualClass(array); // Output -> class java.lang.String- Type Parameters:
T- the class of the data type- Parameters:
array- the array you want to identify- Returns:
- the data type of the elements individually
-
getArrayIndividualClass
@NotNull public static <T> @NotNull Class<T> getArrayIndividualClass(T @NotNull [] @NotNull [] array) Returns the class of the individual object in an array.Example:
String[][] array = new String[0][0]; Class<?> cls = Cls.getArrayIndividualClass(array); // Output -> class java.lang.String- Type Parameters:
T- the class of the data type- Parameters:
array- the array you want to identify- Returns:
- the data type of the elements individually
-
getArrayMultipleIndividualClass
@NotNull public static <T> @NotNull Class<T> getArrayMultipleIndividualClass(@NotNull @NotNull Object array) Returns the class of the individual object in an array.Example:
String[][][] array = new String[0][0][0]; // or more Class<?> cls = Cls.getArrayIndividualClass(array); // Output -> class java.lang.String- Type Parameters:
T- the class of the data type- Parameters:
array- the array you want to identify- Returns:
- the data type of the elements individually
-