@Override public Object getServerVersion() { return ReflectionUtil.newInstanceOfFhirServerType("org.hl7.fhir.dstu2016may.hapi.ctx.FhirServerDstu2_1"); }
private void invokeInitialize(Object theProvider, Class<?> clazz) { for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) { Initialize initialize = m.getAnnotation(Initialize.class); if (initialize != null) { invokeInitializeOrDestroyMethod(theProvider, m, "initialize"); } } Class<?> supertype = clazz.getSuperclass(); if (!Object.class.equals(supertype)) { invokeInitialize(theProvider, supertype); } }
Class<?> collectionType = ReflectionUtil.getGenericCollectionTypeOfMethodReturnType(theMethod); if (collectionType != null) { if (!Object.class.equals(collectionType) && !IBaseResource.class.isAssignableFrom(collectionType)) {
public IBase newInstance() { return ReflectionUtil.newInstance(myChildType); }
myParamBinder = new CalendarBinder(); myParamType = RestSearchParameterTypeEnum.DATE; } else if (IPrimitiveType.class.isAssignableFrom(type) && ReflectionUtil.isInstantiable(type)) { RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) theContext.getElementDefinition((Class<? extends IPrimitiveType<?>>) type); if (def.getNativeType() != null) {
if (Collection.class.isAssignableFrom(parameterType)) { innerCollectionType = (Class<? extends java.util.Collection<?>>) parameterType; parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(theMethod, paramIndex); parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(theMethod, paramIndex); Class<?> genericType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(theMethod, paramIndex); if (Date.class.equals(genericType)) { BaseRuntimeElementDefinition<?> dateTimeDef = theContext.getElementDefinition("dateTime");
@Override protected IPrimitiveType<?> doParse(String theString) { IPrimitiveType<?> instance = ReflectionUtil.newInstance(myType); instance.setValueAsString(theString); return instance; }
myParamBinder = new CalendarBinder(); myParamType = RestSearchParameterTypeEnum.DATE; } else if (IPrimitiveType.class.isAssignableFrom(type) && ReflectionUtil.isInstantiable(type)) { RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) theContext.getElementDefinition((Class<? extends IPrimitiveType<?>>) type); if (def.getNativeType() != null) {
if (Collection.class.isAssignableFrom(parameterType)) { innerCollectionType = (Class<? extends java.util.Collection<?>>) parameterType; parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(theMethod, paramIndex); parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(theMethod, paramIndex);
@Override public Object getServerVersion() { return ReflectionUtil.newInstanceOfFhirServerType("org.hl7.fhir.instance.FhirServerDstu2Hl7Org2"); }
/** * 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; }
private void invokeDestroy(Object theProvider, Class<?> clazz) { for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) { Destroy destroy = m.getAnnotation(Destroy.class); if (destroy != null) { invokeInitializeOrDestroyMethod(theProvider, m, "destroy"); } } Class<?> supertype = clazz.getSuperclass(); if (!Object.class.equals(supertype)) { invokeDestroy(theProvider, supertype); } }
Class<?> collectionType = ReflectionUtil.getGenericCollectionTypeOfMethodReturnType(theMethod); if (collectionType != null) { if (!Object.class.equals(collectionType) && !IBaseResource.class.isAssignableFrom(collectionType)) {
myParamBinder = new CalendarBinder(); myParamType = RestSearchParameterTypeEnum.DATE; } else if (IPrimitiveType.class.isAssignableFrom(type) && ReflectionUtil.isInstantiable(type)) { RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) theContext.getElementDefinition((Class<? extends IPrimitiveType<?>>) type); if (def.getNativeType() != null) {
if (Collection.class.isAssignableFrom(parameterType)) { innerCollectionType = (Class<? extends java.util.Collection<?>>) parameterType; parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(theMethod, paramIndex); parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(theMethod, paramIndex);
@Override public Object getServerVersion() { return ReflectionUtil.newInstanceOfFhirServerType("org.hl7.fhir.r4.hapi.ctx.FhirServerR4"); }
@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; }
private void removeResourceMethods(Object theProvider, Class<?> clazz, Collection<String> resourceNames) throws ConfigurationException { for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) { BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, getFhirContext(), theProvider); if (foundMethodBinding == null) { continue; // not a bound method } if (foundMethodBinding instanceof ConformanceMethodBinding) { myServerConformanceMethod = null; continue; } String resourceName = foundMethodBinding.getResourceName(); if (!resourceNames.contains(resourceName)) { resourceNames.add(resourceName); } } }
returnTypeFromMethod = ReflectionUtil.getGenericCollectionTypeOfMethodReturnType(theMethod); if (returnTypeFromMethod == null) { ourLog.trace("Method {} returns a non-typed list, can't verify return type", theMethod);
myParamBinder = new CalendarBinder(); myParamType = RestSearchParameterTypeEnum.DATE; } else if (IPrimitiveType.class.isAssignableFrom(type) && ReflectionUtil.isInstantiable(type)) { RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) theContext.getElementDefinition((Class<? extends IPrimitiveType<?>>) type); if (def.getNativeType() != null) {