Here is my use case:
I have these classes on the serverside.
class Individual {
protected String uri;
protected int id;
}
class Person extends Individual {
// Person properties like names, address etc
String type = "Person";
}
class Role extends Individual {
// Role properties like name, title etc
String type = "Role";
}
class Organization extends Individual {
// Org properties like name name, address etc
String type = "Organization";
}
I have a class say Action
like below.
class Action {
String performedBy; // This can be any Individual
}
I have a controller that accepts an Action
. I want the Individual
to be correctly assigned depending on what the client sends. How should my Action
& other classes be defined to achieve this?
if I send the following, I want performedBy
to be a Person
.
{
"id": 10,
"uri":"uri_blah",
"lastname": "last_name",
"type":"Person"
}