Interface CustomScope<A extends Annotation>

Type Parameters:
A - An annotation type
All Known Implementing Classes:
AbstractConcurrentCustomScope, RefreshScope

@Indexed(CustomScope.class) public interface CustomScope<A extends Annotation>
Represents a custom scope within the BeanContext.
Since:
1.0
Author:
Graeme Rocher
See Also:
  • Method Details

    • annotationType

      Class<A> annotationType()
      Returns:
      The scope annotation type
    • getOrCreate

      <T> T getOrCreate(BeanCreationContext<T> creationContext)
      Resolve an object from the given scope.
      Type Parameters:
      T - The bean generic type
      Parameters:
      creationContext - The creation context
      Returns:
      The bean instance
    • remove

      <T> Optional<T> remove(BeanIdentifier identifier)
      Remove a bean definition from the scope.
      Type Parameters:
      T - The generic type
      Parameters:
      identifier - The BeanIdentifier
      Returns:
      An Optional of the instance that was destroyed if it exists
    • findBeanRegistration

      default <T> Optional<BeanRegistration<T>> findBeanRegistration(T bean)
      Get the BeanDefinition for the given bean.
      Type Parameters:
      T - The bean generic type
      Parameters:
      bean - The bean
      Returns:
      The bean definition if it can be resolved
    • findBeanRegistration

      default <T> Optional<BeanRegistration<T>> findBeanRegistration(BeanDefinition<T> beanDefinition)
      Get the BeanDefinition for the given bean.
      Type Parameters:
      T - The bean generic type
      Parameters:
      beanDefinition - The bean definition
      Returns:
      The bean definition if it can be resolved
      Since:
      3.5.0