Class CreatorWrapper<T>

  • Type Parameters:
    T - Type of the created instance

    @Beta
    @PublicAPI
    public class CreatorWrapper<T>
    extends Object
    CreatorWrapper acts as a type- and instance -dependent service loader.

    A creator method simply creates an instance of a type from an instance of a parameter type. (Consider here the Descriptors API createXXXComparator methods.) When the parameter type has free parameters it should be implemented as an immutable parameter object - builder class pair. This wrapper usually wraps a default instance of such immutable parameter objects; however it returns an associated builder to change.

    Please note that this class is marked with Beta annotation, so it can be subject of incompatible changes or removal in later releases.

    • Method Detail

      • getBuilderOrParameterObject

        public Object getBuilderOrParameterObject()
        Get the parameter object or its mutable builder if exists.

        If the returned object is mutable then its state will be considered upon creation

        Returns:
        The wrapped parameter object or its builder when exists.
      • getShortName

        public String getShortName()
      • getName

        public String getName()
      • getDescription

        public String getDescription()
      • create

        public T create()
        Invoke creator method.

        Use builder if exists, otherwise initial

        Returns:
        The created instance