com.devexperts.qd.util
Class QDConfig

java.lang.Object
  extended by com.devexperts.qd.util.QDConfig

public class QDConfig
extends java.lang.Object

Configuration utilities.


Method Summary
static java.lang.Object convertValueToObject(java.lang.Class type, java.lang.String value)
          Converts string value of the corresponding type to object.
static java.lang.String parseProperties(java.lang.String desc, java.util.Collection<java.lang.String> props)
          Parses additional properties at the end of the given description string.
static void setDefaultProperties(java.lang.Object instance, java.lang.Class<?> intf, java.lang.String prefix)
           
static void setProperties(java.lang.Object instance, java.lang.Class<?> intf, java.util.List<java.lang.String> kvlist)
           
static void setProperties(java.lang.Object instance, java.util.List<java.lang.String> kvlist)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseProperties

public static java.lang.String parseProperties(java.lang.String desc,
                                               java.util.Collection<java.lang.String> props)
                                        throws InvalidFormatException
Parses additional properties at the end of the given description string. Properties can be enclosed in pairs of matching '(...)' or '[...]'. Multiple properties can be specified with multiple pair of braces or be comma-separated inside a single pair, so both "something[prop1,prop2]" and "something[prop1][prop2]" are valid properties specifications. All braces must go in matching pairs. Original string and all properties string are trimmed from extra space, so extra spaces around or inside braces are ignored.

Parameters:
desc - Description string to parse.
props - Collection of strings where parsed properties are added to.
Returns:
The resulting description string without properties.
Throws:
InvalidFormatException - when description string is malformed.

convertValueToObject

public static java.lang.Object convertValueToObject(java.lang.Class type,
                                                    java.lang.String value)
                                             throws InvalidFormatException
Converts string value of the corresponding type to object.

Throws:
InvalidFormatException - if value has wrong format.

setProperties

public static void setProperties(java.lang.Object instance,
                                 java.util.List<java.lang.String> kvlist)
                          throws InvalidFormatException
Throws:
InvalidFormatException

setProperties

public static void setProperties(java.lang.Object instance,
                                 java.lang.Class<?> intf,
                                 java.util.List<java.lang.String> kvlist)
                          throws InvalidFormatException
Throws:
InvalidFormatException

setDefaultProperties

public static void setDefaultProperties(java.lang.Object instance,
                                        java.lang.Class<?> intf,
                                        java.lang.String prefix)