org.apache.struts2.osgi

## Class DelegatingObjectFactory

- java.lang.Object
- - com.opensymphony.xwork2.ObjectFactory
  - - org.apache.struts2.osgi.DelegatingObjectFactory

- All Implemented Interfaces:
    Serializable, ObjectFactoryDestroyable

      public class DelegatingObjectFactory
      extends ObjectFactory
      implements ObjectFactoryDestroyable

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DelegatingObjectFactory()` Create a DelegatingObjectFactory instance for constructing objects needed by the OSGi plugin.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `buildBean(Class clazz, Map extraContext)`
    `Object` | `buildBean(String className, Map<String,Object> extraContext, boolean injectInternal)`
    `void` | `destroy()`
    `Class` | `getClassInstance(String className)`
    `boolean` | `isNoArgConstructorRequired()`
    `void` | `setBundleResourceLoader(BundleAccessor rl)`
    `void` | `setDelegateObjectFactory(Container container, String delegate)`
    `void` | `setOsgiConfigurationProvider(PackageProvider osgiConfigurationProvider)`

    - ### Methods inherited from class com.opensymphony.xwork2.ObjectFactory

      `buildAction, buildBean, buildConverter, buildInterceptor, buildResult, buildUnknownHandler, buildValidator, injectInternalBeans, setActionFactory, setClassLoader, setContainer, setConverterFactory, setInterceptorFactory, setResultFactory, setUnknownHandlerFactory, setValidatorFactory`

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

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

- - ### Constructor Detail

    - #### DelegatingObjectFactory

          public DelegatingObjectFactory()

      Create a DelegatingObjectFactory instance for constructing objects needed by the OSGi plugin. Note: Due to some Core components (e.g. DefaultTypeConverterCreator) calling on the object factory before the OSGi plugin can be initialized, we need something like a default delegate factory on construction. The Struts object factory would be the default delegate factory, but unfortunately the ObjectFactory hierarchy does not allow us to access the ancestor container or classloader. The best we can do is call the ancestor in the event no delegate has been set.

  - ### Method Detail

    - #### setDelegateObjectFactory

          public void setDelegateObjectFactory(Container container,
                                               String delegate)

    - #### setBundleResourceLoader

          public void setBundleResourceLoader(BundleAccessor rl)

    - #### isNoArgConstructorRequired

          public boolean isNoArgConstructorRequired()

      Overrides:
        `isNoArgConstructorRequired` in class `ObjectFactory`

    - #### buildBean

          public Object buildBean(Class clazz,
                                  Map extraContext)
                           throws Exception

      Overrides:
        `buildBean` in class `ObjectFactory`
      Throws:
        `Exception`

    - #### buildBean

          public Object buildBean(String className,
                                  Map<String,Object> extraContext,
                                  boolean injectInternal)
                           throws Exception

      Overrides:
        `buildBean` in class `ObjectFactory`
      Throws:
        `Exception`

    - #### getClassInstance

          public Class getClassInstance(String className)
                                 throws ClassNotFoundException

      Overrides:
        `getClassInstance` in class `ObjectFactory`
      Throws:
        `ClassNotFoundException`

    - #### destroy

          public void destroy()

      Specified by:
        `destroy` in interface `ObjectFactoryDestroyable`

    - #### setOsgiConfigurationProvider

          public void setOsgiConfigurationProvider(PackageProvider osgiConfigurationProvider)

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.