com.ibm.rational.rpe.common.utils
Class FeatureUtils

java.lang.Object
  extended by com.ibm.rational.rpe.common.utils.FeatureUtils

public class FeatureUtils
extends java.lang.Object

Utility class for working with Feature objects


Constructor Summary
FeatureUtils()
           
 
Method Summary
static boolean compare(Feature feature1, Feature feature2)
          Compares the two features that are provided as arguments.
static boolean compareFeatures(java.util.Collection<Feature> features1, java.util.Collection<Feature> features2)
          Compares the two collection of features that are provided as arguments.
static void copyFromParent(Feature elementFi, Feature parentFi, java.util.Collection<java.lang.String> nonInheritableProperties)
          Copies the parent properties excepting those in the notInheritableProperties list
static void copyFromParent(com.ibm.rational.rpe.common.template.model.FormatInfo elementFi, com.ibm.rational.rpe.common.template.model.FormatInfo parentFi)
          Replaces the values of all properties in elementFi with the values of the properties from parentFi.
static void copyFromParent(com.ibm.rational.rpe.common.template.model.FormatInfo elementFi, com.ibm.rational.rpe.common.template.model.FormatInfo parentFi, java.util.Map<java.lang.String,java.lang.String> cannotInheritedProperties)
          Deprecated. 
static void copyFromParent(java.util.List<Feature> parentFeatures, com.ibm.rational.rpe.common.template.model.FormatInfo childFormat, java.lang.String tag)
          Internal.
static Feature findFeature(Feature context, java.lang.String tag)
          Finds the first feature with the tag tag in the context feature.
static java.util.List<Feature> findFeatures(Feature context, java.lang.String tag)
          Finds all the features with the tag tag in the context feature.
static void removeFeatures(Feature context, java.lang.String tag)
          Removes from the context feature all of the features with a matching tag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureUtils

public FeatureUtils()
Method Detail

findFeature

public static Feature findFeature(Feature context,
                                  java.lang.String tag)
Finds the first feature with the tag tag in the context feature. The search is not recursive.

Parameters:
context - - the feature where the search is to be performed
tag - - the tag to search value
Returns:
the first feature with this tag

findFeatures

public static java.util.List<Feature> findFeatures(Feature context,
                                                   java.lang.String tag)
Finds all the features with the tag tag in the context feature. The search is recursive.

Parameters:
context - - the feature where the search is to be performed
tag - - the tag to search value
Returns:
all the features with a matching tag

compareFeatures

public static boolean compareFeatures(java.util.Collection<Feature> features1,
                                      java.util.Collection<Feature> features2)
Compares the two collection of features that are provided as arguments.

Parameters:
features1 -
features2 -
Returns:
true if the collections are equal: they contain the same features

compare

public static boolean compare(Feature feature1,
                              Feature feature2)
Compares the two features that are provided as arguments.

Parameters:
features1 -
features2 -
Returns:
true if the features are equal, they contain the same properties and values. The comparison is recursive.

removeFeatures

public static void removeFeatures(Feature context,
                                  java.lang.String tag)
Removes from the context feature all of the features with a matching tag

Parameters:
context - the target feature
tag - the tag to look for

copyFromParent

public static void copyFromParent(Feature elementFi,
                                  Feature parentFi,
                                  java.util.Collection<java.lang.String> nonInheritableProperties)
Copies the parent properties excepting those in the notInheritableProperties list


copyFromParent

@Deprecated
public static void copyFromParent(com.ibm.rational.rpe.common.template.model.FormatInfo elementFi,
                                             com.ibm.rational.rpe.common.template.model.FormatInfo parentFi,
                                             java.util.Map<java.lang.String,java.lang.String> cannotInheritedProperties)
Deprecated. 

Deprecated in 1.2.1.1. Do not use.


copyFromParent

public static void copyFromParent(com.ibm.rational.rpe.common.template.model.FormatInfo elementFi,
                                  com.ibm.rational.rpe.common.template.model.FormatInfo parentFi)
Replaces the values of all properties in elementFi with the values of the properties from parentFi.

Parameters:
elementFi -
parentFi -

copyFromParent

public static void copyFromParent(java.util.List<Feature> parentFeatures,
                                  com.ibm.rational.rpe.common.template.model.FormatInfo childFormat,
                                  java.lang.String tag)
Internal. Do not use.

Parameters:
elementFi -
parentFi -