org.camunda.bpm.container.impl.metadata
Class PropertyHelper

java.lang.Object
  extended by org.camunda.bpm.container.impl.metadata.PropertyHelper

public class PropertyHelper
extends Object

Author:
Daniel Meyer

Constructor Summary
PropertyHelper()
           
 
Method Summary
static void applyProperties(Object configuration, Map<String,String> properties)
          Sets an objects fields via reflection from String values.
static void applyProperty(Object configuration, String key, String stringValue)
           
static Object convertToClass(String value, Class<?> clazz)
          Converts a value to the type of the given field.
static boolean getBooleanProperty(Map<String,String> properties, String name, boolean defaultValue)
           
static String resolveProperty(Properties props, String original)
          Replaces Ant-style property references if the corresponding keys exist in the provided Properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyHelper

public PropertyHelper()
Method Detail

getBooleanProperty

public static boolean getBooleanProperty(Map<String,String> properties,
                                         String name,
                                         boolean defaultValue)

convertToClass

public static Object convertToClass(String value,
                                    Class<?> clazz)
Converts a value to the type of the given field.

Parameters:
value -
field -
Returns:

applyProperty

public static void applyProperty(Object configuration,
                                 String key,
                                 String stringValue)

applyProperties

public static void applyProperties(Object configuration,
                                   Map<String,String> properties)
Sets an objects fields via reflection from String values. Depending on the field's type the respective values are converted to int or boolean.

Parameters:
configuration -
properties -
Throws:
ProcessEngineException - if a property is supplied that matches no field or if the field's type is not String, nor int, nor boolean.

resolveProperty

public static String resolveProperty(Properties props,
                                     String original)
Replaces Ant-style property references if the corresponding keys exist in the provided Properties.

Parameters:
props - contains possible replacements
original - may contain Ant-style templates
Returns:
the original string with replaced properties or the unchanged original string if no placeholder found.


Copyright © 2015 camunda services GmbH. All rights reserved.