Package org.apache.naming.factory

## Class FactoryBase

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

All Implemented Interfaces:
  `javax.naming.spi.ObjectFactory`

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

    public abstract class FactoryBase
    extends java.lang.Object
    implements javax.naming.spi.ObjectFactory

Abstract base class that provides common functionality required by sub-classes. This class exists primarily to reduce code duplication.

### Constructor Summary

Constructors
`FactoryBase()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected abstract javax.naming.spi.ObjectFactory` `getDefaultFactory​(javax.naming.Reference ref)` If a default factory is available for the given reference type, create the default factory.
`protected abstract java.lang.Object` `getLinked​(javax.naming.Reference ref)` If this reference is a link to another JNDI object, obtain that object.
`java.lang.Object` `getObjectInstance​(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable<?,​?> environment)` Creates a new object instance.
`protected abstract boolean` `isReferenceTypeSupported​(java.lang.Object obj)` Determines if this factory supports processing the provided reference object.

### Methods inherited from class java.lang.Object

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

### Constructor Detail

#### FactoryBase

    public FactoryBase()

### Method Detail

#### getObjectInstance

    public final java.lang.Object getObjectInstance​(java.lang.Object obj,
                                                    javax.naming.Name name,
                                                    javax.naming.Context nameCtx,
                                                    java.util.Hashtable<?,​?> environment)
                                             throws java.lang.Exception

Creates a new object instance.

Specified by:
  `getObjectInstance` in interface `javax.naming.spi.ObjectFactory`
Parameters:
  `obj` - The reference object describing the object to create
Throws:
  `java.lang.Exception`

#### isReferenceTypeSupported

    protected abstract boolean isReferenceTypeSupported​(java.lang.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 javax.naming.spi.ObjectFactory getDefaultFactory​(javax.naming.Reference ref)
                                                                 throws javax.naming.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:
  `javax.naming.NamingException` - If the default factory cannot be created

#### getLinked

    protected abstract java.lang.Object getLinked​(javax.naming.Reference ref)
                                           throws javax.naming.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:
  `javax.naming.NamingException` - Error accessing linked object