In my optimization model, I use piecewise-linear constraints with the output of $y[m]$. The question or problem I have now is whether there is a way in Gurobi (Java) to form the integral for this PWL in my objective function, from $-20$ to my $x[m]$, where $x[m]$ is my optimization variable. I need the area between the $x$-axis and the PWL constraint, where $y[m]$ is always $\ge0$.
Integrating a piecewise linear function means you end up with a piecewise quadratic function.
Unless there is come convex structure in the resulting piecewise quadratic function (i.e. the PWL is non-decreasing) you will end up with a model involving nonconvexities.
It was an interesting question so I had to play around a bit with it, and wrote a small post here https://yalmip.github.io/example/integratedpwa/. It is not Java, but the basic idea in the 'hard way' should be easily transferable to any modelling language.