I wanted to know the exact difference between method chaining and fluent interface. As I understand it, method chaining is just running the methods of previous method return objects while avoiding temporary variables. An example of this could be Integer.parseInt(str).intValue()
?
With respect to fluent interface, each method of the object is chained by a point, without having to be related to the previous method The two techniques make modifiers methods return to host objects, so that multiple modifiers can be invoked in a single expression like this:
new Car().StartsEngine().OpenWindow()
is this correct?
Aucun commentaire:
Enregistrer un commentaire