Skip to content

Commit 0b7d37f

Browse files
committed
Remove ConfigDocumentFactory java.io.File methods from shared and put in JvmNative
1 parent d91399b commit 0b7d37f

File tree

2 files changed

+40
-33
lines changed

2 files changed

+40
-33
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,44 @@
11
package org.ekrich.config.parser
22

3+
import java.io.File
4+
5+
import org.ekrich.config.ConfigParseOptions
6+
import org.ekrich.config.impl.Parseable
7+
38
/**
49
* [[ConfigFactoryDocument]] methods common to JVM and Native
510
*/
611
abstract class ConfigDocumentFactoryJvmNative
7-
extends ConfigDocumentFactoryShared {}
12+
extends ConfigDocumentFactoryShared {
13+
14+
/**
15+
* Parses a file into a ConfigDocument instance.
16+
*
17+
* @param file
18+
* the file to parse
19+
* @param options
20+
* parse options to control how the file is interpreted
21+
* @return
22+
* the parsed configuration
23+
* @throws org.ekrich.config.ConfigException
24+
* on IO or parse errors
25+
*/
26+
def parseFile(file: File, options: ConfigParseOptions): ConfigDocument =
27+
Parseable.newFile(file, options).parseConfigDocument()
28+
29+
/**
30+
* Parses a file into a ConfigDocument instance as with
31+
* [[#parseFile(file:java\.io\.File,options:org\.ekrich\.config\.ConfigParseOptions)* parseFile(File, ConfigParseOptions)]]
32+
* but always uses the default parse options.
33+
*
34+
* @param file
35+
* the file to parse
36+
* @return
37+
* the parsed configuration
38+
* @throws org.ekrich.config.ConfigException
39+
* on IO or parse errors
40+
*/
41+
def parseFile(file: File): ConfigDocument =
42+
parseFile(file, ConfigParseOptions.defaults)
43+
44+
}

sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigDocumentFactoryShared.scala

+2-32
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package org.ekrich.config.parser
22

3+
import java.io.Reader
4+
35
import org.ekrich.config.ConfigParseOptions
46
import org.ekrich.config.impl.Parseable
5-
import java.io.File
6-
import java.io.Reader
77

88
/**
99
* Shared Factory methods for creating
@@ -41,36 +41,6 @@ abstract class ConfigDocumentFactoryShared {
4141
def parseReader(reader: Reader): ConfigDocument =
4242
parseReader(reader, ConfigParseOptions.defaults)
4343

44-
/**
45-
* Parses a file into a ConfigDocument instance.
46-
*
47-
* @param file
48-
* the file to parse
49-
* @param options
50-
* parse options to control how the file is interpreted
51-
* @return
52-
* the parsed configuration
53-
* @throws org.ekrich.config.ConfigException
54-
* on IO or parse errors
55-
*/
56-
def parseFile(file: File, options: ConfigParseOptions): ConfigDocument =
57-
Parseable.newFile(file, options).parseConfigDocument()
58-
59-
/**
60-
* Parses a file into a ConfigDocument instance as with
61-
* [[#parseFile(file:java\.io\.File,options:org\.ekrich\.config\.ConfigParseOptions)* parseFile(File, ConfigParseOptions)]]
62-
* but always uses the default parse options.
63-
*
64-
* @param file
65-
* the file to parse
66-
* @return
67-
* the parsed configuration
68-
* @throws org.ekrich.config.ConfigException
69-
* on IO or parse errors
70-
*/
71-
def parseFile(file: File): ConfigDocument =
72-
parseFile(file, ConfigParseOptions.defaults)
73-
7444
/**
7545
* Parses a string which should be valid HOCON or JSON.
7646
*

0 commit comments

Comments
 (0)