cleaned up getting the return type for the resource method

This commit is contained in:
Yogthos 2014-02-27 12:07:12 -05:00
parent 7e979449b2
commit f2d530112e
2 changed files with 3 additions and 3 deletions

View File

@ -36,8 +36,8 @@ public class ResourceMethod {
this.resourceType = resourceType; this.resourceType = resourceType;
} }
public IResource getResourceType() throws IllegalAccessException, InstantiationException { public Class getResourceType() throws IllegalAccessException, InstantiationException {
return (IResource)resourceType.newInstance(); return resourceType.getClass();
} }
public RequestType getRequestType() { public RequestType getRequestType() {

View File

@ -165,7 +165,7 @@ public class Service extends HttpServlet {
ResourceMethod resourceMethod = resource.getMethod(params.keySet()); ResourceMethod resourceMethod = resource.getMethod(params.keySet());
if (null == resourceMethod) throw new MethodNotFoundException("No resource method available for the supplied parameters " + params); if (null == resourceMethod) throw new MethodNotFoundException("No resource method available for the supplied parameters " + params);
FhirContext ctx = new FhirContext(resourceMethod.getResourceType().getClass()); FhirContext ctx = new FhirContext(resourceMethod.getResourceType());
XmlParser p = new XmlParser(ctx); XmlParser p = new XmlParser(ctx);
response.getWriter().write(p.encodeResourceToString(resourceMethod.invoke(params))); response.getWriter().write(p.encodeResourceToString(resourceMethod.invoke(params)));
} catch (Throwable t) { } catch (Throwable t) {