BeanRepository (Apache Tomcat 11.0.24 API Documentation)
Description: declaration: package: org.apache.jasper.compiler, class: BeanRepository

# Class BeanRepository

java.lang.Object
org.apache.jasper.compiler.BeanRepository

public class BeanRepository extends Object
Repository of {page, request, session, application}-scoped beans

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BeanRepository(ClassLoader loader, ErrorDispatcher err)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addBean(Node.UseBean n, String s, String type, String scope)`
  Registers a scoped bean.
  `boolean`
  `checkVariable(String bean)`
  Checks if a bean with the given name is registered.
  `Class<?>`
  `getBeanType(String bean)`
  Returns the class of a registered bean.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BeanRepository

    public BeanRepository(ClassLoader loader, ErrorDispatcher err)
    Constructor.
    Parameters:
      `loader` - The class loader
      `err` - The error dispatcher that will be used to report errors

- ## Method Details

  - ### addBean

    public void addBean(Node.UseBean n, String s, String type, String scope) throws JasperException
    Registers a scoped bean.
    Parameters:
      `n` - the UseBean node
      `s` - the bean name
      `type` - the bean type
      `scope` - the bean scope
    Throws:
      `JasperException` - if the scope is invalid

  - ### getBeanType

    public Class<?> getBeanType(String bean) throws JasperException
    Returns the class of a registered bean.
    Parameters:
      `bean` - the bean name
    Returns:
      the bean class
    Throws:
      `JasperException` - if the class cannot be loaded

  - ### checkVariable

    public boolean checkVariable(String bean)
    Checks if a bean with the given name is registered.
    Parameters:
      `bean` - the bean name
    Returns:
      true if the bean is registered