Class BrAPISchemaReader

java.lang.Object
org.brapi.schematools.core.brapischema.BrAPISchemaReader

public class BrAPISchemaReader extends Object
  • Constructor Details

    • BrAPISchemaReader

      public BrAPISchemaReader()
  • Method Details

    • readDirectories

      public List<BrAPIObjectType> readDirectories(Path schemaDirectory) throws BrAPISchemaReaderException
      Reads the schema module directories within a parent directory. Each directory in the parent directory is a module and the JSON schemas in the directories are object types
      Parameters:
      schemaDirectory - the parent directory that holds all the module directories
      Returns:
      a list of BrAPIObjectType with one type per JSON Schema
      Throws:
      BrAPISchemaReaderException - if there is a problem reading the directories or JSON schemas
    • readSchema

      public BrAPIObjectType readSchema(Path schemaPath, String module) throws BrAPISchemaReaderException
      Reads a single object type from an JSON schema. If the JSON schema contain more than one type definition only the first is returned
      Parameters:
      schemaPath - a JSON schema file
      module - the module in which the object resides
      Returns:
      BrAPIObjectType with one type per JSON Schema
      Throws:
      BrAPISchemaReaderException - if there is a problem reading the JSON schema
    • readSchema

      public BrAPIObjectType readSchema(String schema, String module) throws BrAPISchemaReaderException
      Reads a single object type from an JSON schema string. If the JSON schema contain more than one type definition only the first is returned
      Parameters:
      schema - a JSON schema string
      module - the module in which the object resides
      Returns:
      BrAPIObjectType with one type per JSON Schema
      Throws:
      BrAPISchemaReaderException - if there is a problem reading the JSON schema