FactoryBase (Apache Tomcat 10.1.48 API Documentation)
Description: declaration: package: org.apache.naming.factory, class: FactoryBase

# Class FactoryBase

java.lang.Object
org.apache.naming.factory.FactoryBase

All Implemented Interfaces:
  `ObjectFactory`

Direct Known Subclasses:
  `EjbFactory, ResourceEnvFactory, ResourceFactory, TransactionFactory`

public abstract class FactoryBase extends Object implements ObjectFactory
Abstract base class that provides common functionality required by subclasses. This class exists primarily to reduce code duplication.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FactoryBase()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract ObjectFactory`
  `getDefaultFactory(Reference ref)`
  If a default factory is available for the given reference type, create the default factory.
  `protected abstract Object`
  `getLinked(Reference ref)`
  If this reference is a link to another JNDI object, obtain that object.
  `final Object`
  `getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)`
  `protected abstract boolean`
  `isReferenceTypeSupported(Object obj)`
  Determines if this factory supports processing the provided reference object.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### FactoryBase

    public FactoryBase()

- ## Method Details

  - ### getObjectInstance

    public final Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws Exception
    Specified by:
      `getObjectInstance` in interface `ObjectFactory`
    Throws:
      `Exception`

  - ### isReferenceTypeSupported

    protected abstract boolean isReferenceTypeSupported(Object obj)
    Determines if this factory supports processing the provided reference object.
    Parameters:
      `obj` - The object to be processed
    Returns:
      `true` if this factory can process the object, otherwise `false`

  - ### getDefaultFactory

    protected abstract ObjectFactory getDefaultFactory(Reference ref) throws NamingException
    If a default factory is available for the given reference type, create the default factory.
    Parameters:
      `ref` - The reference object to be processed
    Returns:
      The default factory for the given reference object or `null` if no default factory exists.
    Throws:
      `NamingException` - If the default factory cannot be created

  - ### getLinked

    protected abstract Object getLinked(Reference ref) throws NamingException
    If this reference is a link to another JNDI object, obtain that object.
    Parameters:
      `ref` - The reference object to be processed
    Returns:
      The linked object or `null` if linked objects are not supported by or not configured for this reference object
    Throws:
      `NamingException` - Error accessing linked object