org.jopendocument.util
Class ProductInfo

java.lang.Object
  extended by org.jopendocument.util.ProductInfo

public class ProductInfo
extends Object

Useful for defining product wide values, like version, from a property file.

Author:
Sylvain

Field Summary
static String NAME
           
static String PROPERTIES_NAME
           
static String VERSION
           
 
Constructor Summary
ProductInfo(Map<String,String> map)
           
ProductInfo(Properties props)
           
ProductInfo(String name)
           
 
Method Summary
static ProductInfo createDefault()
          Create a product info from the default properties file, "/product.properties".
static ProductInfo getInstance()
          If setInstance(ProductInfo) was called with a non-null value, return that ; otherwise use createDefault().
 String getName()
           
 String getProperty(String name)
           
 String getProperty(String name, String def)
           
 String getVersion()
           
static void setInstance(ProductInfo i)
          Set the current instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTIES_NAME

public static final String PROPERTIES_NAME
See Also:
Constant Field Values

NAME

public static final String NAME
See Also:
Constant Field Values

VERSION

public static final String VERSION
See Also:
Constant Field Values
Constructor Detail

ProductInfo

public ProductInfo(String name)

ProductInfo

public ProductInfo(Map<String,String> map)

ProductInfo

public ProductInfo(Properties props)
Method Detail

getInstance

public static final ProductInfo getInstance()
If setInstance(ProductInfo) was called with a non-null value, return that ; otherwise use createDefault().

Returns:
the current instance, can be null.

setInstance

public static void setInstance(ProductInfo i)
Set the current instance.

Parameters:
i - the new instance, can be null.

createDefault

public static final ProductInfo createDefault()
                                       throws IOException
Create a product info from the default properties file, "/product.properties".

Returns:
the default properties, or null if they couldn't be found.
Throws:
IOException - if properties couldn't be loaded.

getProperty

public final String getProperty(String name)

getProperty

public final String getProperty(String name,
                                String def)

getName

public final String getName()

getVersion

public final String getVersion()


Copyright © 2010 jOpenDocument All Rights Reserved.