Class ReflectionUtils

java.lang.Object
org.gcube.common.events.impl.ReflectionUtils

public class ReflectionUtils extends Object
Library-wide reflection utilities.
Author:
Fabio Simeoni, Luca Frosini (ISTI-CNR)
  • Method Details

    • typeOf

      public static Type typeOf(Object event)
      Returns the actual type of an event, handling Event wrappers appropriately.
      Parameters:
      event - the event object
      Returns:
      the type of the event
    • valueOf

      public static Object valueOf(Object event)
      Returns the actual value of an event, unwrapping Event wrappers if necessary.
      Parameters:
      event - the event object
      Returns:
      the unwrapped event value
    • isCollectionType

      public static boolean isCollectionType(Type t)
      Checks if the given type is a Collection type.
      Parameters:
      t - the type to check
      Returns:
      true if the type is a Collection type
    • elementTypeOf

      public static Type elementTypeOf(Type t)
      Returns the element type of a Collection type.
      Parameters:
      t - the collection type
      Returns:
      the element type
      Throws:
      RuntimeException - if invoked with non-collection type or type variable
    • containsVariable

      public static boolean containsVariable(Type t)
      Checks if the given type contains type variables.
      Parameters:
      t - the type to check
      Returns:
      true if the type contains type variables