001package io.avaje.inject;
002
003import java.util.Set;
004
005/**
006 * A bean entry with priority and optional name.
007 *
008 * @see BeanScope#all()
009 */
010public interface BeanEntry {
011
012  /**
013   * Priority of externally supplied bean.
014   */
015  int SUPPLIED = 2;
016
017  /**
018   * Priority of <code>@Primary</code> bean.
019   */
020  int PRIMARY = 1;
021
022  /**
023   * Priority of normal bean.
024   */
025  int NORMAL = 0;
026
027  /**
028   * Priority of <code>@Secondary</code> bean.
029   */
030  int SECONDARY = -1;
031
032  /**
033   * Return the bean name.
034   */
035  String qualifierName();
036
037  /**
038   * Return the bean instance.
039   */
040  Object bean();
041
042  /**
043   * The bean instance type.
044   */
045  Class<?> type();
046
047  /**
048   * Return the priority indicating if the bean is Supplied Primary, Normal or Secondary.
049   */
050  int priority();
051
052  /**
053   * Return the type keys for this bean.
054   * <p>
055   * This is the set of type, interface types and annotation types that the entry is registered for.
056   */
057  Set<String> keys();
058
059  /**
060   * Return true if the entry has a key for this type.
061   * <p>
062   * This is true if the keys contains the canonical name of the given type.
063   *
064   * @param type The type to match. Can be any type including concrete, interface or annotation type.
065   */
066  boolean hasKey(Class<?> type);
067
068}