Code example for TypeToken

Methods: getRawType

0
    public void marshallJson(ObjectNode node, String fieldName, T payload) throws Exception
    { 
        if ( payload == null )
        { 
            //noinspection unchecked 
            payload = (T)payloadType.getRawType().newInstance();
        } 
         
        node.putPOJO(fieldName, payload);
    } 
 
	@Override 
    public T unMarshallJson(JsonNode node) throws Exception
    { 
        T payload;
        ObjectMapper mapper = new ObjectMapper();
        //noinspection unchecked 
        payload = (T)mapper.readValue(node, payloadType.getRawType());
        return payload;
    }