Skip to content

Instantly share code, notes, and snippets.

@frsyuki
Last active August 29, 2015 14:24
Show Gist options
  • Save frsyuki/cfe868385d853a3995e1 to your computer and use it in GitHub Desktop.
Save frsyuki/cfe868385d853a3995e1 to your computer and use it in GitHub Desktop.
@MessagePackPolimorhpicType("type")
public abstract class PlanNode
{
...
public static final Deserializer type = new PolymorphicDeserializer()
.add("error", ErrorNode.class)
.add("engine", EngineNode.class);
}
public class ErrorNode extends PlanNode
{
}
public class EngineNode extends PlanNode
{
}
public class MyCustomNode extends PlanNode
{
static {
PlanNode.type.add("my_custom", MyCustomNode.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment