001package org.hl7.fhir.r4.utils; 002 003import java.util.ArrayList; 004import java.util.List; 005 006 007public class TypesUtilities { 008 009 public static class WildcardInformation { 010 private String typeName; 011 private String comment; 012 public WildcardInformation(String typeName, String comment) { 013 super(); 014 this.typeName = typeName; 015 this.comment = comment; 016 } 017 public WildcardInformation(String typeName) { 018 super(); 019 this.typeName = typeName; 020 } 021 public String getTypeName() { 022 return typeName; 023 } 024 public String getComment() { 025 return comment; 026 } 027 028 } 029 030 public static List<String> wildcardTypes() { 031 List<String> res = new ArrayList<String>(); 032 for (WildcardInformation wi : wildcards()) 033 res.add(wi.getTypeName()); 034 return res; 035 } 036 037 // this is the master list for what data types are allowed where the types = * 038 // that this list is incomplete means that the following types cannot have fixed values in a profile: 039 // Narrative 040 // Meta 041 // Any of the IDMP data types 042 // You have to walk into them to profile them. 043 // 044 public static List<WildcardInformation> wildcards() { 045 List<WildcardInformation> res = new ArrayList<WildcardInformation>(); 046 047 // primitive types 048 res.add(new WildcardInformation("base64Binary")); 049 res.add(new WildcardInformation("boolean")); 050 res.add(new WildcardInformation("canonical")); 051 res.add(new WildcardInformation("code", "(only if the extension definition provides a <a href=\"terminologies.html#code\">fixed</a> binding to a suitable set of codes)")); 052 res.add(new WildcardInformation("date")); 053 res.add(new WildcardInformation("dateTime")); 054 res.add(new WildcardInformation("decimal")); 055 res.add(new WildcardInformation("id")); 056 res.add(new WildcardInformation("instant")); 057 res.add(new WildcardInformation("integer")); 058 res.add(new WildcardInformation("markdown")); 059 res.add(new WildcardInformation("oid")); 060 res.add(new WildcardInformation("positiveInt")); 061 res.add(new WildcardInformation("string")); 062 res.add(new WildcardInformation("time")); 063 res.add(new WildcardInformation("unsignedInt")); 064 res.add(new WildcardInformation("uri")); 065 res.add(new WildcardInformation("url")); 066 res.add(new WildcardInformation("uuid")); 067 068 // Complex general purpose data types 069 res.add(new WildcardInformation("Address")); 070 res.add(new WildcardInformation("Age")); 071 res.add(new WildcardInformation("Annotation")); 072 res.add(new WildcardInformation("Attachment")); 073 res.add(new WildcardInformation("CodeableConcept")); 074 res.add(new WildcardInformation("Coding")); 075 res.add(new WildcardInformation("ContactPoint")); 076 res.add(new WildcardInformation("Count")); 077 res.add(new WildcardInformation("Distance")); 078 res.add(new WildcardInformation("Duration")); 079 res.add(new WildcardInformation("HumanName")); 080 res.add(new WildcardInformation("Identifier")); 081 res.add(new WildcardInformation("Money")); 082 res.add(new WildcardInformation("Period")); 083 res.add(new WildcardInformation("Quantity")); 084 res.add(new WildcardInformation("Range")); 085 res.add(new WildcardInformation("Ratio")); 086 res.add(new WildcardInformation("Reference", " - a reference to another resource")); 087 res.add(new WildcardInformation("SampledData")); 088 res.add(new WildcardInformation("Signature")); 089 res.add(new WildcardInformation("Timing")); 090 091 // metadata types 092 res.add(new WildcardInformation("ParameterDefinition")); 093 res.add(new WildcardInformation("DataRequirement")); 094 res.add(new WildcardInformation("RelatedArtifact")); 095 res.add(new WildcardInformation("ContactDetail")); 096 res.add(new WildcardInformation("Contributor")); 097 res.add(new WildcardInformation("TriggerDefinition")); 098 res.add(new WildcardInformation("UsageContext")); 099 100 // special cases 101 res.add(new WildcardInformation("Dosage")); 102 return res; 103 } 104} 105