Class SchemaGenerator

java.lang.Object
javax.xml.bind.SchemaOutputResolver
org.duracloud.common.xml.SchemaGenerator

public class SchemaGenerator extends javax.xml.bind.SchemaOutputResolver
Schema generator which can be used to generate a schema for pojo classes which have been marked up with JAXB annotations.
  • Constructor Details

    • SchemaGenerator

      public SchemaGenerator(String fileName)
      Creates a SchemaGenerator indicating the preferred name of the generated schema file.
      Parameters:
      fileName - of the schema
    • SchemaGenerator

      public SchemaGenerator(String fileName, File schemaDir)
      Creates a SchemaGenerator indicating the preferred name of the generated schema file and the directory in which is should be stored.
      Parameters:
      fileName - of the schema
      schemaDir - directory in which to create the schema
  • Method Details

    • generateSchema

      public void generateSchema(Class... classes) throws javax.xml.bind.JAXBException, IOException
      Generates an XML Schema which includes the given classes
      Parameters:
      classes - to include in the schema definition
      Throws:
      javax.xml.bind.JAXBException
      IOException
    • createOutput

      public Result createOutput(String namespaceUri, String defaultFileName) throws IOException
      Called by the schema generation process. There is no need to call this method directly.
      Specified by:
      createOutput in class javax.xml.bind.SchemaOutputResolver
      Throws:
      IOException