Class SimpleFactory

  • All Implemented Interfaces:
    ReturnTypeFactory


    public class SimpleFactory
    extends java.lang.Object
    implements ReturnTypeFactory
    Generates unmonitored, streamlined implementations.
    • Method Detail

      • createNullableOk

        @Nonnull
        public <T> RetNullable<T> createNullableOk​(@Nullable
                                                   T value)
        Description copied from interface: ReturnTypeFactory
        Create a RetNullable instance with a value.
        Specified by:
        createNullableOk in interface ReturnTypeFactory
        Type Parameters:
        T - type of the value.
        Parameters:
        value - value to store in the return object.
        Returns:
        the return object.
      • createNullableFromProblems

        @Nonnull
        public <T> RetNullable<T> createNullableFromProblems​(@Nonnull
                                                             java.util.List<Problem> problems)
        Description copied from interface: ReturnTypeFactory
        Create a RetNullable instance with one or more problems. The problems are checked before calling to have at least 1 value, no values are null, and the collection is unmodifiable.
        Specified by:
        createNullableFromProblems in interface ReturnTypeFactory
        Type Parameters:
        T - type of the value.
        Parameters:
        problems - collection of 1 or more problem values.
        Returns:
        the return object.
      • createValOk

        @Nonnull
        public <T> RetVal<T> createValOk​(@Nonnull
                                         T value)
        Description copied from interface: ReturnTypeFactory
        Create a new RetVal instance that has a value and no problems. The passed-in value is checked before calling to ensure it is non-null.
        Specified by:
        createValOk in interface ReturnTypeFactory
        Type Parameters:
        T - type of the value.
        Parameters:
        value - non-null value; guaranteed to be non-null.
        Returns:
        a RetVal containing the value.
      • createValFromProblems

        @Nonnull
        public <T> RetVal<T> createValFromProblems​(@Nonnull
                                                   java.util.List<Problem> problems)
        Description copied from interface: ReturnTypeFactory
        Create a new RetVal instance that has errors. The problems are checked before calling to have at least 1 value, no values are null, and the collection is unmodifiable.
        Specified by:
        createValFromProblems in interface ReturnTypeFactory
        Type Parameters:
        T - type of the value
        Parameters:
        problems - list of other problems to include in this value; guaranteed to have at least 1 value.
        Returns:
        an error RetVal.
      • createVoidFromProblems

        @Nonnull
        public RetVoid createVoidFromProblems​(@Nonnull
                                              java.util.List<Problem> problems)
        Description copied from interface: ReturnTypeFactory
        Constructs a RetVoid instance with the collections of problems. The list of problems is guaranteed by the caller to have at least 1 problem, no values are null, and the collection is unmodifiable.
        Specified by:
        createVoidFromProblems in interface ReturnTypeFactory
        Parameters:
        problems - list of problems that should be included in this object.
        Returns:
        a RetVoid with all the given problems.