Package org.tquadrat.foundation.config
Annotation Interface INIFileConfig
@ClassVersion(sourceVersion="$Id: INIFileConfig.java 1015 2022-02-09 08:25:36Z tquadrat $")
@Documented
@Retention(CLASS)
@Target(TYPE)
@API(status=STABLE,
since="0.1.0")
public @interface INIFileConfig
The definition of an
INI
file that is used in the context of a
configuration bean implementing
INIBeanSpec
.- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: INIFileConfig.java 1015 2022-02-09 08:25:36Z tquadrat $
- Since:
- 0.1.0
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements
-
Element Details
-
comment
In case the configuration file is created by the program, this comment will be written to it.- Returns:
- The file comment.
- Default:
""
-
mustExist
boolean mustExistFlag that indicates whether the configuration file must already exist prior to the first attempt to open it. Iftrue
and the file does not exist, the creation of the configuration bean will fail with anExceptionInInitializerError
that has anFileNotFoundException
as the cause.- Returns:
true
if the file needs to exist on program start,false
if it will be created when missing.
- Default:
false
-
path
The filename of the
INI
file.If the filename starts …
- … with
'/'
(on UNIX) or'C:\'
(or another drive letter on MS Windows) it represents an absolute path and will be used as is.
Sample:/etc/configs/app.ini
- … with the prefix
$USER/
, it will be resolved against the home folder of the current user.
Sample:$USER/.config/app.ini
On Ubuntu, and for the user otto, this resolves to/home/otto/.config/app.ini
. - … with the prefix
${<property>}
, it will be resolved against the path that is represented by the property with the name<property>
. Obviously, the property has to be of typePath
, otherwise the generated configuration bean will not compile.
Sample:${configPath}app.ini
IfgetConfigPath()
return/opt/data/configs
, this resolves to/opt/data/configs/app.ini
.
In any other case, the filename represents a relative path that is resolved against the current working directory. So if the value is
data/config/app.ini
, and the current working directory is/home/otto
, it resolves to/home/otto/config/app.ini
.- Returns:
- The filename.
- … with
-