Class PrototypeFactory
- java.lang.Object
-
- org.apache.commons.collections.functors.PrototypeFactory
-
@Deprecated(since="2021-04-30") public class PrototypeFactory extends java.lang.ObjectDeprecated.Apache Commons Collections version 3.x is being deprecated from AEMaaCS. The upgraded version 4.4 of Commons Collections is already included as replacement. Customers are advised to upgrade to this version of the library. Please note: the package name was changed to org.apache.commons.collections4. Further note that there are AEM APIs currently exposing the old collections classes; these will be updated in upcoming releases.Factory implementation that creates a new instance each time based on a prototype.- Since:
- Commons Collections 3.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static FactorygetInstance(java.lang.Object prototype)Deprecated.Factory method that performs validation.
-
-
-
Method Detail
-
getInstance
public static Factory getInstance(java.lang.Object prototype)
Deprecated.Factory method that performs validation.Creates a Factory that will return a clone of the same prototype object each time the factory is used. The prototype will be cloned using one of these techniques (in order):
- public clone method
- public copy constructor
- serialization clone
WARNING: from v3.2.2 onwards this method will return a
Factorythat will throw anUnsupportedOperationExceptionwhen trying to serialize or de-serialize it to prevent potential remote code execution exploits.In order to re-enable serialization support the following system property can be used (via -Dproperty=true):
org.apache.commons.collections.enableUnsafeSerialization
- Parameters:
prototype- the object to clone each time in the factory- Returns:
- the
prototypefactory - Throws:
java.lang.IllegalArgumentException- if the prototype is nulljava.lang.IllegalArgumentException- if the prototype cannot be cloned
-
-