Creating API that is fluent

后端 未结 9 964
忘掉有多难
忘掉有多难 2020-11-28 03:35

How does one go about create an API that is fluent in nature?

Is this using extension methods primarily?

9条回答
  •  生来不讨喜
    2020-11-28 04:20

    Writting a fluent API it's complicated, that's why I've written Diezel that is a Fluent API generator for Java. It generates the API with interfaces (or course) to:

    1. control the calling flow
    2. catch generic types (like guice one)

    It generates also implementations.

    It's a maven plugin.

提交回复
热议问题