public IBase newInstance() { return ReflectionUtil.newInstance(myChildType); }
@Override protected IPrimitiveType<?> doParse(String theString) { IPrimitiveType<?> instance = ReflectionUtil.newInstance(myType); instance.setValueAsString(theString); return instance; }
/** * Get the restful client factory. If no factory has been set, this will be initialized with * a new ApacheRestfulClientFactory. * * @return the factory used to create the restful clients */ public IRestfulClientFactory getRestfulClientFactory() { if (myRestfulClientFactory == null) { try { myRestfulClientFactory = (IRestfulClientFactory) ReflectionUtil.newInstance(Class.forName("ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory"), FhirContext.class, this); } catch (ClassNotFoundException e) { throw new ConfigurationException("hapi-fhir-client does not appear to be on the classpath"); } } return myRestfulClientFactory; }
@SuppressWarnings("unchecked") public static <T extends IIdType> T convertIdToType(IIdType value, Class<T> theIdParamType) { if (value != null && !theIdParamType.isAssignableFrom(value.getClass())) { IIdType newValue = ReflectionUtil.newInstance(theIdParamType); newValue.setValue(value.getValue()); value = newValue; } return (T) value; }
@SuppressWarnings("unchecked") @Override public Object translateQueryParametersIntoServerArgument(RequestDetails theRequest, BaseMethodBinding<?> theMethodBinding) throws InternalErrorException, InvalidRequestException { List<Object> matchingParamValues = new ArrayList<Object>(); if (theRequest.getRequestType() == RequestTypeEnum.GET) { translateQueryParametersIntoServerArgumentForGet(theRequest, matchingParamValues); } else { translateQueryParametersIntoServerArgumentForPost(theRequest, matchingParamValues); } if (matchingParamValues.isEmpty()) { return null; } if (myInnerCollectionType == null) { return matchingParamValues.get(0); } Collection<Object> retVal = ReflectionUtil.newInstance(myInnerCollectionType); retVal.addAll(matchingParamValues); return retVal; }
public static Object fromInteger(Class<?> theType, IntegerDt theArgument) { if (theArgument == null) { return null; } if (theType.equals(Integer.class)) { return theArgument.getValue(); } IPrimitiveType<?> retVal = (IPrimitiveType<?>) ReflectionUtil.newInstance(theType); retVal.setValueAsString(theArgument.getValueAsString()); return retVal; }
private Object newContainedDt(IResource theTarget) { return ReflectionUtil.newInstance(theTarget.getStructureFhirVersionEnum().getVersionImplementation().getContainedType()); }
public IBase newInstance() { return ReflectionUtil.newInstance(myChildType); }
@Override protected IPrimitiveType<?> doParse(String theString) { IPrimitiveType<?> instance = ReflectionUtil.newInstance(myType); instance.setValueAsString(theString); return instance; }
/** * Get the restful client factory. If no factory has been set, this will be initialized with * a new ApacheRestfulClientFactory. * * @return the factory used to create the restful clients */ public IRestfulClientFactory getRestfulClientFactory() { if (myRestfulClientFactory == null) { try { myRestfulClientFactory = (IRestfulClientFactory) ReflectionUtil.newInstance(Class.forName("ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory"), FhirContext.class, this); } catch (ClassNotFoundException e) { throw new ConfigurationException("hapi-fhir-client does not appear to be on the classpath"); } } return myRestfulClientFactory; }
@SuppressWarnings("unchecked") public static <T extends IIdType> T convertIdToType(IIdType value, Class<T> theIdParamType) { if (value != null && !theIdParamType.isAssignableFrom(value.getClass())) { IIdType newValue = ReflectionUtil.newInstance(theIdParamType); newValue.setValue(value.getValue()); value = newValue; } return (T) value; }
@SuppressWarnings("unchecked") @Override public Object translateQueryParametersIntoServerArgument(RequestDetails theRequest, BaseMethodBinding<?> theMethodBinding) throws InternalErrorException, InvalidRequestException { List<Object> matchingParamValues = new ArrayList<Object>(); if (theRequest.getRequestType() == RequestTypeEnum.GET) { translateQueryParametersIntoServerArgumentForGet(theRequest, matchingParamValues); } else { translateQueryParametersIntoServerArgumentForPost(theRequest, matchingParamValues); } if (matchingParamValues.isEmpty()) { return null; } if (myInnerCollectionType == null) { return matchingParamValues.get(0); } Collection<Object> retVal = ReflectionUtil.newInstance(myInnerCollectionType); retVal.addAll(matchingParamValues); return retVal; }
public static Object fromInteger(Class<?> theType, IntegerDt theArgument) { if (theArgument == null) { return null; } if (theType.equals(Integer.class)) { return theArgument.getValue(); } IPrimitiveType<?> retVal = (IPrimitiveType<?>) ReflectionUtil.newInstance(theType); retVal.setValueAsString(theArgument.getValueAsString()); return retVal; }
private Object newContainedDt(IResource theTarget) { return ReflectionUtil.newInstance(theTarget.getStructureFhirVersionEnum().getVersionImplementation().getContainedType()); }