public RuntimeResourceDefinition getResourceDefinition( FhirVersionEnum theVersion, String theResourceName) { Validate.notNull(theVersion, "theVersion can not be null"); validateInitialized(); if (theVersion.equals(myVersion.getVersion())) { return getResourceDefinition(theResourceName); } Map<String, Class<? extends IBaseResource>> nameToType = myVersionToNameToResourceType.get(theVersion); if (nameToType == null) { nameToType = new HashMap<String, Class<? extends IBaseResource>>(); Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> existing = Collections.emptyMap(); ModelScanner.scanVersionPropertyFile(null, nameToType, theVersion, existing); Map<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>> newVersionToNameToResourceType = new HashMap<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>>(); newVersionToNameToResourceType.putAll(myVersionToNameToResourceType); newVersionToNameToResourceType.put(theVersion, nameToType); myVersionToNameToResourceType = newVersionToNameToResourceType; } Class<? extends IBaseResource> resourceType = nameToType.get(theResourceName.toLowerCase()); if (resourceType == null) { throw new DataFormatException(createUnknownResourceNameError(theResourceName, theVersion)); } return getResourceDefinition(resourceType); }
public boolean isEquivalentTo(FhirVersionEnum theVersion) { if (this.equals(theVersion)) { return true; } if (myEquivalent != null) { return myEquivalent.equals(theVersion); } return false; }