com.xebialabs.deployit.reflect
Class ConfigurationItemReflectionUtils

java.lang.Object
  extended by com.xebialabs.deployit.reflect.ConfigurationItemReflectionUtils

public class ConfigurationItemReflectionUtils
extends java.lang.Object

Contains a number of configuration item reflection utility methods.


Constructor Summary
ConfigurationItemReflectionUtils()
           
 
Method Summary
static
<T> T
getRealConfigurationItem(T possibleCiProxy)
          Returns the real configuration item if this is a ConfigurationItemProxy.
static boolean isIdentical(java.io.Serializable ci1, java.io.Serializable ci2)
          Compares two configuration items and determines whether they are "identical".
static boolean isSimilar(java.io.Serializable ci1, java.io.Serializable ci2)
          Compares two configuration items and determines whether they are "similar".
static java.io.Serializable overrideProperties(java.io.Serializable ci, java.util.Map<java.lang.String,java.lang.String> propertyOverrides)
          Overrides named properties in the given CI with the corresponding values in the propertyOverrides map.
static java.lang.Object toPropertyValue(ConfigurationItemPropertyDescriptor descriptor, java.lang.String value)
          Converts the string representation of the value to an object of the appropriate type for the given property, if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationItemReflectionUtils

public ConfigurationItemReflectionUtils()
Method Detail

getRealConfigurationItem

public static <T> T getRealConfigurationItem(T possibleCiProxy)
Returns the real configuration item if this is a ConfigurationItemProxy.

Type Parameters:
T - the type of the configuration item
Parameters:
possibleCiProxy - the object that is possibly a configuration item proxy.
Returns:
the backing object if possibleCiProxy is a proxy, its value if it is not a proxy.

isSimilar

public static boolean isSimilar(java.io.Serializable ci1,
                                java.io.Serializable ci2)
Compares two configuration items and determines whether they are "similar". Two configuration items are "similar" if their identifying properties have the same value.

Parameters:
ci1 - the first configration item to be compared
ci2 - the second configration item to be compared
Returns:
true if and only if the configuration item are considered "similar".

isIdentical

public static boolean isIdentical(java.io.Serializable ci1,
                                  java.io.Serializable ci2)
Compares two configuration items and determines whether they are "identical". Two configuration items are "identical" if all their properties have the same value.

Parameters:
ci1 - the first configration item to be compared
ci2 - the second configration item to be compared
Returns:
true if and only if the configuration item are considered "identical".

overrideProperties

public static java.io.Serializable overrideProperties(java.io.Serializable ci,
                                                      java.util.Map<java.lang.String,java.lang.String> propertyOverrides)
Overrides named properties in the given CI with the corresponding values in the propertyOverrides map. N.B.: Modifes the CI passed in!


toPropertyValue

public static java.lang.Object toPropertyValue(ConfigurationItemPropertyDescriptor descriptor,
                                               java.lang.String value)
Converts the string representation of the value to an object of the appropriate type for the given property, if possible.



Copyright © 2010. All Rights Reserved.