Class Instantiators


  • public final class Instantiators
    extends java.lang.Object
    Contains utility methods which help to instantiate classes which follow certain conventions. The most common one is that e.g. a class provides a constructor with one argument of a certain type.
    • Method Detail

      • instantiatorFor

        public static <T> Instantiators.OngoingInstantiatorCreation<T> instantiatorFor​(java.lang.Class<T> instanceClass)
        Starting point for fluent clauses to create instantiators for certain type of objects. A typical example for the creation of a certain type of object (Instance) with an argument of a certain type (Argument) could look like this:
         
             Instantiator<Argument, Instance> instantiator = instantiatorFor(Instance.class)
                     .withArgumentType(Argument.class);
        
             Instance instance = instantiator.create(anArgument); // anArgument being of type Argument
         
         
        Parameters:
        instanceClass - the type of the objects to be created by the instantiator
        Returns:
        an objects that provides methods for refinements of the instantiator