Class Duplicators

java.lang.Object
org.fulib.fx.duplicate.Duplicators

public class Duplicators extends Object
A registry for Duplicators.

This class is used to register Duplicators for specific classes.

Call duplicate(Object) to duplicate an object.

Use register(Class, Duplicator) to register a Duplicator for a specific class. You can also override existing Duplicators or extend them to create new ones if you need to add additional properties.

See Also:
  • Constructor Details

    • Duplicators

      public Duplicators()
  • Method Details

    • register

      public static <T> void register(Class<T> clazz, Duplicator<T> duplicator)
      Registers a Duplicator for the given class.
      Type Parameters:
      T - The type of the class
      Parameters:
      clazz - The class to register the Duplicator for
      duplicator - The Duplicator to register
    • duplicate

      public static <T> T duplicate(T object)
      Duplicates the given object using the registered Duplicator.
      Type Parameters:
      T - The type of the object
      Parameters:
      object - The object to duplicate
      Returns:
      The duplicated object
      Throws:
      IllegalArgumentException - If no Duplicator is registered for the given object