Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.此内容没有您所选择的语言版本。
4.26. Instantiate an ArrayList Object Using a Static Factory Method
- Follow this example to instantiate an ArrayList object using a static factory method:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Thesome.package.ListFactory#newListfactory definition establishes that thenewListmethod must be called on thesome.package.ListFactoryclass in order to create the bean. The class attributes define the bean as a List object. The specific kind of List object that it is (be it an ArrayList or a LinkedList), is decided by the ListFactory itself. - Observe this additional example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This defines that an instance of the ListFactory needs to be retrieved using the static methodgetInstanceand then thenewListmethod needs to be called on the ListFactory object to create the List object. This construct lets you use singleton factories.