public interface ConfigOrigin
ConfigValue
for use in error messages. Obtain the origin of a value
with ConfigValue.origin()
. Exceptions may have an origin, see
ConfigException.origin
, but be careful because
ConfigException.origin()
may return null.
It's best to use this interface only for debugging; its accuracy is "best effort" rather than guaranteed, and a potentially-noticeable amount of memory could probably be saved if origins were not kept around, so in the future there might be some option to discard origins.
Do not implement this interface; it should only be implemented by the config library. Arbitrary implementations will not work because the library internals assume a specific concrete implementation. Also, this interface is likely to grow new methods over time, so third-party implementations will break.
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
comments()
Returns any comments that appeared to "go with" this place in the file.
|
java.lang.String |
description()
Returns a string describing the origin of a value or exception.
|
java.lang.String |
filename()
Returns a filename describing the origin.
|
int |
lineNumber()
Returns a line number where the value or exception originated.
|
java.lang.String |
resource()
Returns a classpath resource name describing the origin.
|
java.net.URL |
url()
Returns a URL describing the origin.
|
ConfigOrigin |
withComments(java.util.List<java.lang.String> comments)
Returns a
ConfigOrigin based on this one, but with the given
comments. |
ConfigOrigin |
withLineNumber(int lineNumber)
Returns a
ConfigOrigin based on this one, but with the given
line number. |
java.lang.String description()
java.lang.String filename()
java.net.URL url()
java.lang.String resource()
int lineNumber()
java.util.List<java.lang.String> comments()
withComments(java.util.List<java.lang.String> comments)
ConfigOrigin
based on this one, but with the given
comments. Does not modify this instance or any ConfigValue
s with
this origin (since they are immutable). To set the returned origin to a
ConfigValue
, use ConfigValue.withOrigin(com.typesafe.config.ConfigOrigin)
.
Note that when the given comments are equal to the comments on this object,
a new instance may not be created and this
is returned directly.
comments
- the comments used on the returned originwithLineNumber(int lineNumber)
ConfigOrigin
based on this one, but with the given
line number. This origin must be a FILE, URL or RESOURCE. Does not modify
this instance or any ConfigValue
s with this origin (since they are
immutable). To set the returned origin to a ConfigValue
, use
ConfigValue.withOrigin(com.typesafe.config.ConfigOrigin)
.
Note that when the given lineNumber are equal to the lineNumber on this
object, a new instance may not be created and this
is returned
directly.
lineNumber
- the new line number