* generally be one or more of of the constants declared in
* {@link RoutingTypes}.
*/
@SuppressWarnings("unchecked")
public static <T> T parseAsDto(String payload, int... types) {
ServerToClientDto responseData = (ServerToClientDto) Jso.deserialize(payload);
for (int type : types) {
if (responseData.getType() == type) {
return (T) responseData;
}
}
throw new IllegalArgumentException("Unexpected dto type " + responseData.getType());
}