@RestController
public class AnswersController
extends java.lang.Object
| Constructor and Description |
|---|
AnswersController() |
| Modifier and Type | Method and Description |
|---|---|
AnswerBO |
add(AnswerVO answerVO,
java.lang.Long questionId)
This method adds a new answer to a specified by id question.
|
java.util.List<AnswerBO> |
answers(java.lang.Long questionId)
This method returns all answers that are available
to a specified by id question.
|
void |
delete(java.lang.Long questionId,
java.lang.Long answerId)
This method deletes a specified by id answer to a specified by id question.
|
AnswerBO |
update(AnswerVO answerVO,
java.lang.Long questionId,
java.lang.Long answerId)
This method updates an existing specified by id answer to a specified by id question.
|
@RequestMapping(value="api/questions/{questionId}/answers")
public java.util.List<AnswerBO> answers(@PathVariable
java.lang.Long questionId)
questionId - Id of question to receive answers to@RequestMapping(method=POST,
value="api/questions/{questionId}/answers")
public AnswerBO add(@RequestBody
AnswerVO answerVO,
@PathVariable
java.lang.Long questionId)
answerVO - AnswerVO's instance with user's input dataquestionId - Id of question to add an answer to@RequestMapping(method=PUT,
value="api/questions/{questionId}/answers/{answerId}")
public AnswerBO update(@RequestBody
AnswerVO answerVO,
@PathVariable
java.lang.Long questionId,
@PathVariable
java.lang.Long answerId)
answerVO - AnswerVO's instance with user's changed and old data.questionId - Id of question to edit an answer toanswerId - Id of answer to edit@RequestMapping(method=DELETE,
value="api/questions/{questionId}/answers/{answerId}")
public void delete(@PathVariable
java.lang.Long questionId,
@PathVariable
java.lang.Long answerId)
questionId - Id of question to delete an answer toanswerId - Id of answer to delete