de.smartics.util.test.properties
Class ProjectProperties

Package class diagram package ProjectProperties
java.lang.Object
  extended by de.smartics.util.test.properties.ProjectProperties

public final class ProjectProperties
     
     
extends Object

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

DEFAULT_RESOURCE

public static final String DEFAULT_RESOURCE
The name of the properties file searched in the class path root.

The value of this constant is "artifacts.properties".

Constant Field Value:
"artifacts.properties"
Constructor Detail

ProjectProperties

public ProjectProperties()
Constructor using the thread's context class loader.


ProjectProperties

public ProjectProperties(Class<?> locator)
Constructor using a class to locate the .

Parameters:
locator - the class to access the class loader to search for .

ProjectProperties

public ProjectProperties(ClassLoader loader)
Constructor using a class loader to locate the .

Parameters:
loader - the class loader to search for .
Method Detail

get

public String get(String key)
Returns the GAV string for the given key.

Parameters:
key - a key defined in .
Returns:
the value associated with the given key.


Copyright © 2008-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.