|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.smartics.util.test.properties.ProjectProperties
public final class ProjectProperties
A mapping from project-defined keys to values dependent on project properties.
This can be used in a Maven environment to derive GAV strings from POM dependencies, where the version numbers are defined as properties.
Place a file named the root folder of the class path and provide a mapping from free-to-choose keys to GAV strings like this:
smartics-properties-core=de.smartics.properties:smartics-properties-core:${smartics-properties-core.version}
Using filtering to resolve the properties like smartics-properties-core.version
.
{ @source protected static final ProjectProperties PROJECT_PROPERTIES = new ProjectProperties(MyClass.class); }
Then you can fetch GAV strings resolved with the current version number from the POM by your keys.
Field Summary | |
---|---|
static String |
DEFAULT_RESOURCE The name of the properties file searched in the class path root. |
Constructor Summary | |
---|---|
ProjectProperties() Constructor using the thread's context class loader. |
|
ProjectProperties(Class<?> locator) Constructor using a class to locate the . |
|
ProjectProperties(ClassLoader loader) Constructor using a class loader to locate the . |
Method Summary | |
---|---|
String |
get(String key) Returns the GAV string for the given key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_RESOURCE
The value of this constant is "artifacts.properties".
"artifacts.properties"
Constructor Detail |
---|
public ProjectProperties()
public ProjectProperties(Class<?> locator)
locator
- the class to access the class loader to search for .
public ProjectProperties(ClassLoader loader)
loader
- the class loader to search for .
Method Detail |
---|
public String get(String key)
key
- a key defined in .
key
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |