Interface TraverseArbitrary.Traverser

  • Enclosing interface:
    TraverseArbitrary<T>

    public static interface TraverseArbitrary.Traverser
    A traverser describes how to travers a given type by providing a hook to resolve a parameter into an arbitrary and a means to find all relevant creators (constructors or factory methods) for a type that does not have a suitable default arbitrary.
    • Method Detail

      • resolveParameter

        default java.util.Optional<Arbitrary<java.lang.Object>> resolveParameter​(TypeUsage parameterType)
        Create an arbitrary for a creator parameter. Only implement if you do not want to resolve the parameter through its default arbitrary (if there is one)
        Parameters:
        parameterType - The typeUsage of the parameter, including annotations
        Returns:
        New Arbitrary or Optional.empty()
      • findCreators

        java.util.Set<java.lang.reflect.Executable> findCreators​(TypeUsage targetType)
        Return all creators (constructors or static factory methods) for a type to traverse.

        If you return an empty set, the attempt to generate a type will be stopped by throwing an exception.

        Parameters:
        targetType - The target type for which to find creators (factory methods or constructors)
        Returns:
        A set of at least one creator.