title: How can I output the return value of a Method like totalAmount in an Spring Rest Entity
body: <p>is it possible to output a return Value totalAmount of an Entity ShoppingCart that is not a Value in the Class but a Method? So for example I have a Class Shoppingcart with a List of Items. and a Method totalAmount. Now when I make a request to the API with the URL <a href="http://localhost:8082/carts/1" rel="nofollow noreferrer">http://localhost:8082/carts/1</a> I want to get a response like the following:</p>
  
  <pre><code>{ 
  "creationDate": "2016-12-07T09:45:38.000+0000",
    "items": [
      {
        "itemName": "Nintendo 2DS",
        "description": "Konsole from Nintendo",
        "price": 300.5,
        "quantity": 3
      },
      {
        "itemName": "Nintendo Classic",
        "description": "Classic nintendo Console from the 80th...",
        "price": 75,
        "quantity": 2
      }
    ],
    "totalAmount": "1051,50",
    "_links": {
      "self": {
        "href": "http://localhost:8082/carts/2"
      },
      "cart": {
        "href": "http://localhost:8082/carts/2"
      },
      "checkout": {
        "href": "http://localhost:8083/order"
      }
    }
  }
  </code></pre>
  
  <p>Currently the response of an API request looks like the following:</p>
  
  <pre><code>{
    "creationDate": "2016-12-07T09:45:38.000+0000",
    "items": [
      {
        "itemName": "Nintendo 2DS",
        "description": "Konsole from Nintendo",
        "price": 300.5,
        "quantity": 3
      },
      {
        "itemName": "Nintendo Classic",
        "description": "Classic nintendo Console from the 80th...",
        "price": 75,
        "quantity": 2
      }
    ],
    "_links": {
      "self": {
        "href": "http://localhost:8082/carts/2"
      },
      "cart": {
        "href": "http://localhost:8082/carts/2"
      },
      "checkout": {
        "href": "http://localhost:8083/order"
      }
    }
  }
  </code></pre>
  
  <p>Is there an Annotation that do this job or something other. I tried to add it in the CartResourceProcessor (org.springframework.hateoas.ResourceProcessor) but there is only the possibility to add additional links. Or do I need to add a Class value totalAmount? </p>