Skip to content

Commit

Permalink
Remove ConfigDocumentFactory java.io.File methods from shared and put…
Browse files Browse the repository at this point in the history
… in JvmNative
  • Loading branch information
ekrich committed Aug 8, 2024
1 parent 522df33 commit 91cdf26
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
package org.ekrich.config.parser

import java.io.File

import org.ekrich.config.ConfigParseOptions
import org.ekrich.config.impl.Parseable

/**
* [[ConfigFactoryDocument]] methods common to JVM and Native
*/
abstract class ConfigDocumentFactoryJvmNative
extends ConfigDocumentFactoryShared {}
extends ConfigDocumentFactoryShared {

/**
* Parses a file into a ConfigDocument instance.
*
* @param file
* the file to parse
* @param options
* parse options to control how the file is interpreted
* @return
* the parsed configuration
* @throws org.ekrich.config.ConfigException
* on IO or parse errors
*/
def parseFile(file: File, options: ConfigParseOptions): ConfigDocument =
Parseable.newFile(file, options).parseConfigDocument()

/**
* Parses a file into a ConfigDocument instance as with
* [[#parseFile(file:java\.io\.File,options:org\.ekrich\.config\.ConfigParseOptions)* parseFile(File, ConfigParseOptions)]]
* but always uses the default parse options.
*
* @param file
* the file to parse
* @return
* the parsed configuration
* @throws org.ekrich.config.ConfigException
* on IO or parse errors
*/
def parseFile(file: File): ConfigDocument =
parseFile(file, ConfigParseOptions.defaults)

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.ekrich.config.parser

import java.io.Reader

import org.ekrich.config.ConfigParseOptions
import org.ekrich.config.impl.Parseable
import java.io.File
import java.io.Reader

/**
* Shared Factory methods for creating
Expand Down Expand Up @@ -41,36 +41,6 @@ abstract class ConfigDocumentFactoryShared {
def parseReader(reader: Reader): ConfigDocument =
parseReader(reader, ConfigParseOptions.defaults)

/**
* Parses a file into a ConfigDocument instance.
*
* @param file
* the file to parse
* @param options
* parse options to control how the file is interpreted
* @return
* the parsed configuration
* @throws org.ekrich.config.ConfigException
* on IO or parse errors
*/
def parseFile(file: File, options: ConfigParseOptions): ConfigDocument =
Parseable.newFile(file, options).parseConfigDocument()

/**
* Parses a file into a ConfigDocument instance as with
* [[#parseFile(file:java\.io\.File,options:org\.ekrich\.config\.ConfigParseOptions)* parseFile(File, ConfigParseOptions)]]
* but always uses the default parse options.
*
* @param file
* the file to parse
* @return
* the parsed configuration
* @throws org.ekrich.config.ConfigException
* on IO or parse errors
*/
def parseFile(file: File): ConfigDocument =
parseFile(file, ConfigParseOptions.defaults)

/**
* Parses a string which should be valid HOCON or JSON.
*
Expand Down

0 comments on commit 91cdf26

Please sign in to comment.