} else if (IPrimitiveType.class.isAssignableFrom(type) && ReflectionUtil.isInstantiable(type)) { RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) theContext.getElementDefinition((Class<? extends IPrimitiveType<?>>) type); if (def.getNativeType() != null) { if (def.getNativeType().equals(Date.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.DATE; } else if (def.getNativeType().equals(String.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.STRING;
elementDef = new RuntimeIdDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass)); } else { elementDef = new RuntimePrimitiveDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
public RuntimePrimitiveDatatypeDefinition(DatatypeDef theDef, Class<? extends IPrimitiveType<?>> theImplementingClass, boolean theStandardType) { super(theDef.name(), theImplementingClass, theStandardType); String resourceName = theDef.name(); if (isBlank(resourceName)) { throw new ConfigurationException("Resource type @" + ResourceDef.class.getSimpleName() + " annotation contains no resource name: " + theImplementingClass.getCanonicalName()); } mySpecialization = theDef.isSpecialization(); myProfileOfType = theDef.profileOf(); if (myProfileOfType.equals(IBaseDatatype.class)) { myProfileOfType = null; } determineNativeType(theImplementingClass); }
@Override void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) { super.sealAndInitialize(theContext, theClassToElementDefinitions); if (myProfileOfType != null) { myProfileOf = theClassToElementDefinitions.get(myProfileOfType); if (myProfileOf == null) { StringBuilder b = new StringBuilder(); b.append("Unknown profileOf value: "); b.append(myProfileOfType); b.append(" in type "); b.append(getImplementingClass().getName()); b.append(" - Valid types: "); b.append(theClassToElementDefinitions.keySet()); throw new ConfigurationException(b.toString()); } } }
FhirContext ctx = theRequest.getServer().getFhirContext(); RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) ctx.getElementDefinition(myParameterType.asSubclass(IBase.class)); IPrimitiveType<?> instance = def.newInstance(); instance.setValueAsString(nextValue); matchingParamValues.add(instance);
defn.getDefinition().addType().setCode(DataTypeEnum.VALUESET_BINDER.fromCodeString(pdef.getName())); } else if (nextChild.getChildType() != null && ICompositeDatatype.class.isAssignableFrom(nextChild.getChildType())) { RuntimeCompositeDatatypeDefinition pdef = (RuntimeCompositeDatatypeDefinition) nextChild.getSingleChildOrThrow();
@Override void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) { super.sealAndInitialize(theContext, theClassToElementDefinitions); if (myProfileOfType != null) { myProfileOf = theClassToElementDefinitions.get(myProfileOfType); if (myProfileOf == null) { StringBuilder b = new StringBuilder(); b.append("Unknown profileOf value: "); b.append(myProfileOfType); b.append(" in type "); b.append(getImplementingClass().getName()); b.append(" - Valid types: "); b.append(theClassToElementDefinitions.keySet()); throw new ConfigurationException(b.toString()); } } }
FhirContext ctx = theRequest.getServer().getFhirContext(); RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) ctx.getElementDefinition(myParameterType.asSubclass(IBase.class)); IPrimitiveType<?> instance = def.newInstance(); instance.setValueAsString(nextValue); matchingParamValues.add(instance);
} else if (IPrimitiveType.class.isAssignableFrom(type) && ReflectionUtil.isInstantiable(type)) { RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) theContext.getElementDefinition((Class<? extends IPrimitiveType<?>>) type); if (def.getNativeType() != null) { if (def.getNativeType().equals(Date.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.DATE; } else if (def.getNativeType().equals(String.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.STRING;
public RuntimePrimitiveDatatypeDefinition(DatatypeDef theDef, Class<? extends IPrimitiveType<?>> theImplementingClass, boolean theStandardType) { super(theDef.name(), theImplementingClass, theStandardType); String resourceName = theDef.name(); if (isBlank(resourceName)) { throw new ConfigurationException("Resource type @" + ResourceDef.class.getSimpleName() + " annotation contains no resource name: " + theImplementingClass.getCanonicalName()); } mySpecialization = theDef.isSpecialization(); myProfileOfType = theDef.profileOf(); if (myProfileOfType.equals(IBaseDatatype.class)) { myProfileOfType = null; } determineNativeType(theImplementingClass); }
elementDef = new RuntimeIdDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass)); } else { elementDef = new RuntimePrimitiveDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
} else if (IPrimitiveType.class.isAssignableFrom(type) && ReflectionUtil.isInstantiable(type)) { RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) theContext.getElementDefinition((Class<? extends IPrimitiveType<?>>) type); if (def.getNativeType() != null) { if (def.getNativeType().equals(Date.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.DATE; } else if (def.getNativeType().equals(String.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.STRING;
} else if (IPrimitiveType.class.isAssignableFrom(type) && ReflectionUtil.isInstantiable(type)) { RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) theContext.getElementDefinition((Class<? extends IPrimitiveType<?>>) type); if (def.getNativeType() != null) { if (def.getNativeType().equals(Date.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.DATE; } else if (def.getNativeType().equals(String.class)) { myParamBinder = new FhirPrimitiveBinder((Class<IPrimitiveType<?>>) type); myParamType = RestSearchParameterTypeEnum.STRING;