Interface JReleaserConfigParser

All Known Implementing Classes:
AbstractJReleaserConfigParser

public interface JReleaserConfigParser
Allows external configuration to be parsed with a custom format.
Since:
0.1.0
Author:
Andres Almiray
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the preferred file extension supported by this parser.
    <T> T
    load(Class<T> type, InputStream inputStream)
    Loads a resource into a given type.
    parse(InputStream inputStream)
    Reads and parses external configuration into a JReleaserModel instance.
    properties(InputStream inputStream)
    Reads and parses external configuration into a Map instance.
    boolean
    supports(String resource)
    Whether the given resource format is supported or not.
    boolean
    supports(Path configFile)
    Whether the given config file format is supported or not.
    void
    validate(Path configFile)
    Checks the contents of the config file for syntax compliance.
  • Method Details

    • getPreferredFileExtension

      String getPreferredFileExtension()
      Returns the preferred file extension supported by this parser.
      Returns:
      the preferred file extension supported by this parser, should never return null.
    • supports

      boolean supports(Path configFile)
      Whether the given config file format is supported or not.

      Implementors would typically look at the file extension.
      Parameters:
      configFile - the configuration file to inspect
      Returns:
      true if the given format is supported, false otherwise.
    • supports

      boolean supports(String resource)
      Whether the given resource format is supported or not.

      Implementors would typically look at the file extension.
      Parameters:
      resource - the resource to inspect
      Returns:
      true if the given format is supported, false otherwise.
    • validate

      void validate(Path configFile) throws IOException
      Checks the contents of the config file for syntax compliance.
      Parameters:
      configFile - the configuration file to inspect
      Throws:
      IOException
    • parse

      JReleaserModel parse(InputStream inputStream) throws IOException
      Reads and parses external configuration into a JReleaserModel instance.
      Parameters:
      inputStream - the configuration's input source
      Returns:
      a configured JReleaserModel instance, should never return null.
      Throws:
      IOException - if an error occurs while reading from the InputStream.
    • load

      <T> T load(Class<T> type, InputStream inputStream) throws IOException
      Loads a resource into a given type.
      Parameters:
      inputStream - the resources' input source
      Returns:
      the parsed instance, should never return null.
      Throws:
      IOException - if an error occurs while reading from the InputStream.
    • properties

      Map<String,String> properties(InputStream inputStream) throws IOException
      Reads and parses external configuration into a Map instance. The input sorce defines key/values as an alternative to the Java properties format.
      Parameters:
      inputStream - the configuration's input source
      Returns:
      a Map instance, should never return null.
      Throws:
      IOException - if an error occurs while reading from the InputStream.
      Since:
      0.2.0