Class InstanceResolver

java.lang.Object
org.apache.phoenix.util.InstanceResolver

public class InstanceResolver extends Object
Resolves object instances registered using the JDK 6+ ServiceLoader.
Since:
2.0
  • Method Details

    • getSingleton

      public static <T> T getSingleton(Class<T> clazz, T defaultInstance)
      Resolves an instance of the specified class if it has not already been resolved.
      Parameters:
      clazz - The type of instance to resolve
      defaultInstance - The instance to use if a custom instance has not been registered
      Returns:
      The resolved instance or the default instance provided. null if an instance is not registered and a default is not provided.
    • get

      public static <T> List get(Class<T> clazz, List<T> defaultInstances)
      Resolves all instances of a specified class and add it to the list of default implementations
      Type Parameters:
      T - Type of class passed
      Parameters:
      clazz - Type of the instance to resolve
      defaultInstances - List of instances that match the type clazz
      Returns:
      List of instance of the specified class. Newly found instances will be added to the existing contents of defaultInstances
    • clearSingletons

      public static void clearSingletons()