java/src/test/java/com/google/fhir/stu3/ProtoFilePrinterTest.java
/** Read and parse the specified StructureDefinition. */
Read and parse the specified StructureDefinition.
Read and parse the specified StructureDefinition .
private StructureDefinition readStructureDefinition(String resourceName) throws IOException {
    File file =
        new File(
            runfiles.rlocation(
                "com_google_fhir/spec/hl7.fhir.core/3.0.1/modified/StructureDefinition-"
                    + resourceName
                    + ".json"));
    if (!file.exists()) {
      file =
          new File(
              runfiles.rlocation(
                  "com_google_fhir/spec/hl7.fhir.core/3.0.1/package/StructureDefinition-"
                      + resourceName
                      + ".json"));
    }
    if (!file.exists()) {
      String lowerCased = resourceName.substring(0, 1).toLowerCase() + resourceName.substring(1);
      file =
          new File(
              runfiles.rlocation(
                  "com_google_fhir/spec/hl7.fhir.core/3.0.1/package/StructureDefinition-"
                      + lowerCased
                      + ".json"));
    }
    String json = Files.asCharSource(file, StandardCharsets.UTF_8).read();
    StructureDefinition.Builder builder = StructureDefinition.newBuilder();
    jsonParser.merge(json, builder);
    return builder.build();
  }
private StructureDefinition readStructureDefinition ( String resourceName ) throws IOException { File file = new File ( runfiles . rlocation ( "com_google_fhir/spec/hl7.fhir.core/3.0.1/modified/StructureDefinition-" + resourceName + ".json" ) ) ; if ( ! file . exists ( ) ) { file = new File ( runfiles . rlocation ( "com_google_fhir/spec/hl7.fhir.core/3.0.1/package/StructureDefinition-" + resourceName + ".json" ) ) ; } if ( ! file . exists ( ) ) { String lowerCased = resourceName . substring ( 0 , 1 ) . toLowerCase ( ) + resourceName . substring ( 1 ) ; file = new File ( runfiles . rlocation ( "com_google_fhir/spec/hl7.fhir.core/3.0.1/package/StructureDefinition-" + lowerCased + ".json" ) ) ; } String json = Files . asCharSource ( file , StandardCharsets . UTF_8 ) . read ( ) ; StructureDefinition . Builder builder = StructureDefinition . newBuilder ( ) ; jsonParser . merge ( json , builder ) ; return builder . build ( ) ; }
Read and parse the specified StructureDefinition.
Read and parse the specified StructureDefinition .