Top Constructors Methods
io.github.darvil.utils

public final Class UtlReflection

extends Object
Class Inheritance
Imports
org.jetbrains.annotations.NotNull, java.lang.reflect.InvocationTargetException, .Method, java.util.List

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static @NotNull String

Returns:

The simple name of the given class.
getSimpleName
(@NotNull Class<?>
The class to get the simple name of.
clazz
)

Returns the simple name of the given class.

public static boolean

Returns:

true if the given parameter types are assignable to the parameter types of the given method.
hasParameters
(Method
The method to check.
method
,
Class<?>...
The parameter types to check.
paramTypes
)

Returns true if the given parameter types are assignable to the parameter types of the given method.

public static <
The type of the class.
T
>
T

Returns:

The instantiated class. If the class could not be instantiated, a RuntimeException is thrown.
instantiate
(Class<T>
The class to instantiate.
clazz
)

Instantiates the given class with a no-argument constructor.

public static <
The type of the class.
T
>
T

Returns:

The instantiated class. If the class could not be instantiated, a RuntimeException is thrown.
instantiate
(Class<T>
The class to instantiate.
clazz
,
@NotNull List<@NotNull Object>
The arguments to pass to the constructor.
args
)

Instantiates the given class with the given arguments.

public static <
The type of the class.
T
>
T

Returns:

The instantiated class. If the class could not be instantiated, a RuntimeException is thrown.
instantiate
(Class<T>
The class to instantiate.
clazz
,
@NotNull List<? extends Class<?>>
The types of the arguments to pass to the constructor.
argTypes
,
@NotNull List<Object>
The arguments to pass to the constructor.
args
)

Instantiates the given class with the given arguments.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

UtlReflectionback to summary
private UtlReflection()

Method Detail

getSimpleNameback to summary
public static @NotNull String getSimpleName(@NotNull Class<?> clazz)

Returns the simple name of the given class. If the class is an anonymous class, then the simple name of the superclass is returned.

Parameters
clazz:@NotNull Class<?>

The class to get the simple name of.

Returns:@NotNull String

The simple name of the given class.

Annotations
@NotNull
hasParametersback to summary
public static boolean hasParameters(Method method, Class<?>... paramTypes)

Returns true if the given parameter types are assignable to the parameter types of the given method.

Parameters
method:Method

The method to check.

paramTypes:Class<?>[]

The parameter types to check.

Returns:boolean

true if the given parameter types are assignable to the parameter types of the given method.

instantiateback to summary
public static <T> T instantiate(Class<T> clazz)

Instantiates the given class with a no-argument constructor.

Parameters
<T>
The type of the class.
clazz:Class<T>

The class to instantiate.

Returns:T

The instantiated class. If the class could not be instantiated, a RuntimeException is thrown.

instantiateback to summary
public static <T> T instantiate(Class<T> clazz, @NotNull List<@NotNull Object> args)

Instantiates the given class with the given arguments.

Parameters
<T>
The type of the class.
clazz:Class<T>

The class to instantiate.

args:@NotNull List<@NotNull Object>

The arguments to pass to the constructor.

Returns:T

The instantiated class. If the class could not be instantiated, a RuntimeException is thrown.

instantiateback to summary
public static <T> T instantiate(Class<T> clazz, @NotNull List<? extends Class<?>> argTypes, @NotNull List<Object> args)

Instantiates the given class with the given arguments.

Parameters
<T>
The type of the class.
clazz:Class<T>

The class to instantiate.

argTypes:@NotNull List<? extends Class<?>>

The types of the arguments to pass to the constructor.

args:@NotNull List<Object>

The arguments to pass to the constructor.

Returns:T

The instantiated class. If the class could not be instantiated, a RuntimeException is thrown.