naming/src/main/java/org/jboss/as/naming/context/ObjectFactoryBuilder.java
public ObjectFactory createObjectFactory(final Object obj, Hashtable<?, ?> environment) throws NamingException {
        try {
            if (obj instanceof Reference) {
                return factoryFromReference((Reference) obj, environment);
            }
        } catch (Throwable ignored) {
        }
        return this;
    }
public ObjectFactory createObjectFactory(final Object obj, Hashtable<?, ?> environment) throws NamingException {
        try {
            if (obj instanceof Reference) {
                return factoryFromReference((Reference) obj, environment);
            }
        } catch (Throwable ignored) {
        }
        return this;
    }
Create an object factory.  If the object parameter is a reference it will attempt to create an {@link javax.naming.spi.ObjectFactory}
from the reference.  If the parameter is not a reference, or the reference does not create an {@link javax.naming.spi.ObjectFactory}
it will return {@code this} as the {@link javax.naming.spi.ObjectFactory} to use.

@param obj         The object bound in the naming context
@param environment The environment information
@return The object factory the object resolves to
@throws NamingException If any problems occur