@Test(expected=IllegalArgumentException.class) public void shouldNotAcceptMethodsWithoutArguments() throws Exception { deserializer.deserialize(new ByteArrayInputStream(new byte[0]), woof); }
public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method javaMethod = method.getMethod(); Class<?>[] types = javaMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException("Methods that consumes xml must receive just one argument: the xml root element"); } XStream xStream = getConfiguredXStream(javaMethod, types); Object[] params = new Object[types.length]; chooseParam(types, params, xStream.fromXML(inputStream)); return params; }
XStreamXMLDeserializer implements XMLDeserializer { public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method javaMethod = method.getMethod(); Class<?>[] types = javaMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException("Methods that consumes xml must receive just one argument: the xml root element"); } XStream xStream = getConfiguredXStream(javaMethod, types); Object[] params = new Object[types.length]; chooseParam(types, params, xStream.fromXML(inputStream)); return params; } }
XStreamXMLDeserializer implements XMLDeserializer { public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method javaMethod = method.getMethod(); Class<?>[] types = javaMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException("Methods that consumes xml must receive just one argument: the xml root element"); } XStream xStream = getConfiguredXStream(javaMethod, types); Object[] params = new Object[types.length]; chooseParam(types, params, xStream.fromXML(inputStream)); return params; } XStreamXMLDeserializer(ParameterNameProvider provider, XStreamBuilder builder); }
XStreamXMLDeserializer implements XMLDeserializer { public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method javaMethod = method.getMethod(); Class<?>[] types = javaMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException("Methods that consumes xml must receive just one argument: the xml root element"); } XStream xStream = getConfiguredXStream(javaMethod, types); Object[] params = new Object[types.length]; chooseParam(types, params, xStream.fromXML(inputStream)); return params; } XStreamXMLDeserializer(ParameterNameProvider provider, XStreamBuilder builder); Object[] deserialize(InputStream inputStream, ResourceMethod method); XStream getConfiguredXStream(Method javaMethod, Class<?>[] types); }
XStreamXMLDeserializer implements XMLDeserializer { public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method javaMethod = method.getMethod(); Class<?>[] types = javaMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException("Methods that consumes xml must receive just one argument: the xml root element"); } XStream xStream = getConfiguredXStream(javaMethod, types); Object[] params = new Object[types.length]; chooseParam(types, params, xStream.fromXML(inputStream)); return params; } XStreamXMLDeserializer(ParameterNameProvider provider, XStreamBuilder builder); Object[] deserialize(InputStream inputStream, ResourceMethod method); XStream getConfiguredXStream(Method javaMethod, Class<?>[] types);  }