Class PerLocatorUtilities

java.lang.Object
org.jvnet.hk2.internal.PerLocatorUtilities

public class PerLocatorUtilities extends Object
These utilities are per service locator. Another service locator may have a different view of the caches stored here
  • Field Details

  • Constructor Details

  • Method Details

    • hasInjectAnnotation

      boolean hasInjectAnnotation(AnnotatedElement annotated)
      Checks whether an annotated element has any annotation that was used for the injection
      Parameters:
      annotated - the annotated element
      locator - The service locator to use (as it will get all the annotations that were added on as well as the normal Inject)
      checkParams - check the params if true
      Returns:
      True if element contains at least one inject annotation
    • getAutoAnalyzerName

      public String getAutoAnalyzerName(Class<?> c)
      Gets the analyzer name from the Service annotation
      Parameters:
      c - The class to get the analyzer name from
      Returns:
      The name of the analyzer (null for default)
    • getInjectionResolver

      public InjectionResolver<?> getInjectionResolver(ServiceLocatorImpl locator, Injectee injectee) throws IllegalStateException
      Returns an injection resolver for the injectee
      Parameters:
      locator - The locator to use when finding the resolver
      injectee - Injectee from which the annotation should be extracted
      Returns:
      Injection resolver used to resolve the injection for the injectee
      Throws:
      IllegalStateException - If we could not find a valid resolver
    • getInjectionResolver

      InjectionResolver<?> getInjectionResolver(ServiceLocatorImpl locator, AnnotatedElement annotatedGuy) throws IllegalStateException
      Returns an injection resolver for this AnnotatedElement. The method cannot be used for constructors or methods.
      Parameters:
      locator - The locator to use when finding the resolver
      annotatedGuy - The annotated class or producer method
      Returns:
      The scope of this class or producer method. If no scope is found will return the dependent scope
      Throws:
      IllegalStateException - If we could not find a valid resolver
    • getInjectionResolver

      private InjectionResolver<?> getInjectionResolver(ServiceLocatorImpl locator, AnnotatedElement annotatedGuy, int position) throws IllegalStateException
      Throws:
      IllegalStateException
    • getInjectAnnotation

      private Annotation getInjectAnnotation(ServiceLocatorImpl locator, AnnotatedElement annotated, boolean checkParams, int position)
      Gets the annotation that was used for the injection
      Parameters:
      locator - The service locator to use (as it will get all the annotations that were added on as well as the normal Inject)
      annotated - the annotated annotated
      checkParams - check the params if true
      position - index of constructor or method parameter which which will be checked for inject annotations. The position parameter is only used when annotated is method or constructor otherwise the value will be ignored.
      Returns:
      The annotation that is the inject annotation, or null if no inject annotation was found
    • computeElementAnnotationInfo

      private AnnotatedElementAnnotationInfo computeElementAnnotationInfo(AnnotatedElement ae)
    • releaseCaches

      public void releaseCaches()
    • shutdown

      public void shutdown()
    • getProxyUtilities

      public ProxyUtilities getProxyUtilities()