Class ReflectionUtil

java.lang.Object
sawfowl.regionguard.utils.ReflectionUtil

public class ReflectionUtil extends Object
  • Constructor Details

    • ReflectionUtil

      public ReflectionUtil()
  • Method Details

    • getValueFromMethodWhithTypeNoArgs

      public static <T, C, O> C getValueFromMethodWhithTypeNoArgs(Class<T> type, Class<C> cast, O fromObject)
      Before using it, you should make sure that the class has only 1 method with the required return type and no arguments.
      Parameters:
      type - - T - The data type you are looking for.
      cast - - C - The type of object returned if the search is successful.
      fromObject - - O - The object in whose class you want to find the method.
    • findField

      public static <T> Optional<T> findField(Object source, Class<T> clazz)