Class BeanStoreEntry<T>

java.lang.Object
org.apache.juneau.cp.BeanStoreEntry<T>
Type Parameters:
T - The bean type.

public class BeanStoreEntry<T> extends Object
Represents a bean in a BeanStore.

A bean entry consists of the following:

  • A class type.
  • A bean or bean supplier that returns an instance of the class type. This can be a subclass of the type.
  • An optional name.
  • Constructor Details

    • BeanStoreEntry

      protected BeanStoreEntry(Class<T> type, Supplier<T> bean, String name)
      Constructor.
      Parameters:
      type - The class type to associate with the bean.
      bean - The bean supplier.
      name - Optional name to associate with the bean. Can be null.
  • Method Details

    • create

      public static <T> BeanStoreEntry<T> create(Class<T> type, Supplier<T> bean, String name)
      Static creator.
      Type Parameters:
      T - The class type to associate with the bean.
      Parameters:
      type - The class type to associate with the bean.
      bean - The bean supplier.
      name - Optional name to associate with the bean. Can be null.
      Returns:
      A new bean store entry.
    • matches

      public boolean matches(Class<?> type)
      Returns true if this bean is exactly of the specified type.
      Parameters:
      type - The class to check. Returns false if null.
      Returns:
      true if this bean is exactly of the specified type.
    • matches

      public boolean matches(Class<?> type, String name)
      Returns true if this bean is exactly of the specified type and has the specified name.
      Parameters:
      type - The class to check. Returns false if null.
      name - The name to check. Can be null to only match if name of entry is null.
      Returns:
      true if this bean is exactly of the specified type and has the specified name.
    • get

      public T get()
      Returns the bean associated with this entry.
      Returns:
      The bean associated with this entry.
    • getType

      public Class<T> getType()
      Returns the type this bean is associated with.
      Returns:
      The type this bean is associated with.
    • getName

      public String getName()
      Returns the name associated with this entry.
      Returns:
      the name associated with this entry. null if no name is associated.
    • properties

      protected JsonMap properties()
      Returns the properties in this object as a simple map for debugging purposes.
      Returns:
      The properties in this object as a simple map.