Class ProjectInfo
Information is stored in the form of a properties file that is accessed at runtime as a resource. This resource must be present as a file at the top of the class file tree of the involved class loader.
A default name for the properties file is fixed as PROJECT_INFO_FILENAME. It is possible, but not recommended, to specify a
different name.
- Since:
- 1.2
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default name of the properties file where project context information is stored. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetProperty(@Opt ClassLoader classLoader, String propertyName, String defaultValue) Queries the value of a project context property.static StringgetProperty(@Opt ClassLoader classLoader, String projectInfoFilename, String propertyName, String defaultValue) Queries the value of a project context property.static StringgetProperty(Class<?> tool, String propertyName, String defaultValue) Queries the value of a tool-specific project context property.
-
Field Details
-
PROJECT_INFO_FILENAME
The default name of the properties file where project context information is stored.- See Also:
-
-
Method Details
-
getProperty
Queries the value of a tool-specific project context property.This operation fails silently and returns the given default value if the property file is not available as a resource, cannot be loaded, or does not contain the expected property.
- Parameters:
tool- the main class of the toolpropertyName- the unqualified name of the propertydefaultValue- the default value for the property- Returns:
- the value of the property with the given name qualified by the name of the given class, or the given default value if not available.
-
getProperty
public static String getProperty(@Opt @Opt ClassLoader classLoader, String propertyName, String defaultValue) Queries the value of a project context property.This operation fails silently and returns the given default value if the property file is not available as a resource, cannot be loaded, or does not contain the expected property.
- Parameters:
classLoader- the class loader from which to obtain the resource file, ornullfor the bootstrap class loaderpropertyName- the qualified name of the propertydefaultValue- the default value for the property- Returns:
- the value of the property with the given name, or the given default value if not available.
-
getProperty
public static String getProperty(@Opt @Opt ClassLoader classLoader, String projectInfoFilename, String propertyName, String defaultValue) Queries the value of a project context property.This operation fails silently and returns the given default value if the property file is not available as a resource, cannot be loaded, or does not contain the expected property.
- Parameters:
classLoader- the class loader from which to obtain the resource file, ornullfor the bootstrap class loaderprojectInfoFilename- the relative name of the of the properties file where project context information is storedpropertyName- the qualified name of the propertydefaultValue- the default value for the property- Returns:
- the value of the property with the given name, or the given default value if not available.
- Since:
- 1.3
-