org.apache.jena.atlas.lib
Class PropertyUtils

java.lang.Object
  extended by org.apache.jena.atlas.lib.PropertyUtils

public class PropertyUtils
extends Object


Constructor Summary
PropertyUtils()
           
 
Method Summary
 void checkMetadata(Properties properties, String key, String expected)
          Check property has the vakue given - throw exception if not.
 void checkOrSetProperty(Properties properties, String key, String expected)
          Check property is an expected value or set if missing
 void ensurePropertySet(Properties properties, String key, String expected)
          Set property if not already set.
 String getOrSetDefault(Properties properties, String key, String expected)
          Get property or the default value - also set the default value if not present
static Boolean getPropertyAsBoolean(Properties properties, String key)
           
static boolean getPropertyAsBoolean(Properties properties, String key, boolean dftValue)
           
static int getPropertyAsInteger(Properties properties, String key)
           
static int getPropertyAsInteger(Properties properties, String key, int defaultValue)
           
static void loadFromFile(Properties properties, String filename)
           
static Properties loadFromFile(String filename)
          Java5 does not have read/write from readers/writers - needed for UTF-8
 boolean propertyEquals(Properties properties, String key, String value)
          Test whether a property has a value.
static void storeToFile(Properties properties, String comment, String filename)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyUtils

public PropertyUtils()
Method Detail

loadFromFile

public static Properties loadFromFile(String filename)
                               throws IOException
Java5 does not have read/write from readers/writers - needed for UTF-8

Throws:
IOException

loadFromFile

public static void loadFromFile(Properties properties,
                                String filename)
                         throws IOException
Throws:
IOException

storeToFile

public static void storeToFile(Properties properties,
                               String comment,
                               String filename)
                        throws IOException
Throws:
IOException

getPropertyAsInteger

public static int getPropertyAsInteger(Properties properties,
                                       String key)

getPropertyAsInteger

public static int getPropertyAsInteger(Properties properties,
                                       String key,
                                       int defaultValue)

getPropertyAsBoolean

public static boolean getPropertyAsBoolean(Properties properties,
                                           String key,
                                           boolean dftValue)

getPropertyAsBoolean

public static Boolean getPropertyAsBoolean(Properties properties,
                                           String key)

propertyEquals

public boolean propertyEquals(Properties properties,
                              String key,
                              String value)
Test whether a property has a value. Null tests equal to not present.


ensurePropertySet

public void ensurePropertySet(Properties properties,
                              String key,
                              String expected)
Set property if not already set.


getOrSetDefault

public String getOrSetDefault(Properties properties,
                              String key,
                              String expected)
Get property or the default value - also set the default value if not present


checkOrSetProperty

public void checkOrSetProperty(Properties properties,
                               String key,
                               String expected)
Check property is an expected value or set if missing


checkMetadata

public void checkMetadata(Properties properties,
                          String key,
                          String expected)
Check property has the vakue given - throw exception if not.



Licenced under the Apache License, Version 2.0