Class ReflectionUtils
java.lang.Object
fr.andross.banitem.utils.attributes.ReflectionUtils
Package utils that use the reflection api of java.
- Version:
 - 3.4
 - Author:
 - EpiCanard
 
- 
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectasNMSCopy(@NotNull org.bukkit.inventory.ItemStack itemStack) Create an NMSItemStack from Bukkit ItemStack.static <T> TcallMethodWithName(@NotNull Object obj, @NotNull String name) Call the first method matching the name.static <T> TcallMethodWithReturnType(@NotNull Object obj, @NotNull Class<? extends T> returnType) Call the first method matching the returnType. 
- 
Method Details
- 
asNMSCopy
public static Object asNMSCopy(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException Create an NMSItemStack from Bukkit ItemStack.- Parameters:
 itemStack- Bukkit ItemStack to convert- Returns:
 - Converted ItemStack
 - Throws:
 ClassNotFoundException- If an exception occurredInvocationTargetException- If an exception occurredIllegalAccessException- If an exception occurredNoSuchMethodException- If an exception occurred
 - 
callMethodWithReturnType
public static <T> T callMethodWithReturnType(@NotNull @NotNull Object obj, @NotNull @NotNull Class<? extends T> returnType) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException Call the first method matching the returnType.- Type Parameters:
 T- Return type- Parameters:
 obj- Object that contains the methodreturnType- Return type class that must be returned by the method- Returns:
 - The value returned by the call to the method
 - Throws:
 InvocationTargetException- If an exception occurredIllegalAccessException- If an exception occurredNoSuchMethodException- If an exception occurred
 - 
callMethodWithName
public static <T> T callMethodWithName(@NotNull @NotNull Object obj, @NotNull @NotNull String name) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException Call the first method matching the name.- Type Parameters:
 T- Return type- Parameters:
 obj- Object that contains the methodname- Name of method to call- Returns:
 - The value returned by the call to the method
 - Throws:
 NoSuchMethodException- If an exception occurredInvocationTargetException- If an exception occurredIllegalAccessException- If an exception occurred
 
 -