-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I want to use storm with a Polymorphic class design. I have a Vehicle class which contains a List<Part> with different types of parts.
I have the following class design:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
abstract class Part {
private double x;
private double y;
private double z;
}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "type")
abstract class EquipablePart extends Part {
private ItemStack item;
}
@JsonTypeName("seat")
class Seat extends Part {
private boolean steer;
}
@JsonTypeName("skin")
class Skin extends EquipablePart {}I would like to store this using Storm. This is currently not possible as far as I know. I'm also not fully sure how this should be implemented. If I convert to JSON using Jackson, it looks like this:
[
{
"type": "skin",
"x": 0,
"y": 0,
"z": 0,
"item": {
"item": "rO0ABXcEAAAAAXNyABpvcmcuYnVra2l0LnV0aWwuaW8uV3JhcHBlcvJQR+zxEm8FAgABTAADbWFw\ndAAPTGphdmEvdXRpbC9NYXA7eHBzcgA1Y29tLmdvb2dsZS5jb21tb24uY29sbGVjdC5JbW11dGFi\nbGVNYXAkU2VyaWFsaXplZEZvcm0AAAAAAAAAAAIAAkwABGtleXN0ABJMamF2YS9sYW5nL09iamVj\ndDtMAAZ2YWx1ZXNxAH4ABHhwdXIAE1tMamF2YS5sYW5nLk9iamVjdDuQzlifEHMpbAIAAHhwAAAA\nBHQAAj09dAABdnQABHR5cGV0AARtZXRhdXEAfgAGAAAABHQAHm9yZy5idWtraXQuaW52ZW50b3J5\nLkl0ZW1TdGFja3NyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2\nYS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAA36dAANTEVBVEhFUl9CT09UU3NxAH4AAHNxAH4A\nA3VxAH4ABgAAAAVxAH4ACHQACW1ldGEtdHlwZXQAC1VuYnJlYWthYmxldAAGRGFtYWdldAAFY29s\nb3J1cQB+AAYAAAAFdAAISXRlbU1ldGF0AA9DT0xPUkFCTEVfQVJNT1JzcgARamF2YS5sYW5nLkJv\nb2xlYW7NIHKA1Zz67gIAAVoABXZhbHVleHABc3EAfgAOAAAAAXNxAH4AAHNxAH4AA3VxAH4ABgAA\nAAVxAH4ACHQABUFMUEhBdAADUkVEdAAEQkxVRXQABUdSRUVOdXEAfgAGAAAABXQABUNvbG9yc3EA\nfgAOAAAA/3NxAH4ADgAAAP9zcQB+AA4AAAAAc3EAfgAOAAAA/w==\n"
}
},
{
"type": "seat",
"x": 0.3,
"y": -1.05,
"z": 0.65,
"steer": true
}
]Please note the type parameter, which is used to determine the class to convert to.
Do you have any idea on the best way to implement this into Storm? I think it can be useful in various situations.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels