com.raritantechnologies.utils.comparators
Class BeanPropertyComparator

java.lang.Object
  extended bycom.raritantechnologies.utils.comparators.BeanPropertyComparator
All Implemented Interfaces:
java.util.Comparator, IComparator, IConfigurable

public class BeanPropertyComparator
extends java.lang.Object
implements IComparator

Objects of this class can be used to determine if a JavaBean Property with a given value is found in some java.lang.Object.

XML Configuration Template:
   <Comparator class="com.raritantechnologies.utils.comparators.BeanPropertyComparator"
                  getMethodName="[name of bean method]"
                  getMethodValue="[value to compare bean value to]" >

     <Comparator class="[implementation of IComparator]" >
       <!-- parameters required by  comparator -->
     </Comparator>

     <!--  Can have a nested BeanPropertyComparator if the initial bean object is itself
              a JavaBean -->
     <NestedComparator getMethodName="[name of bean method]"
                  getMethodValue="[value to compare bean value to]" >
        <!-- parameters of nested BeanPropertyComparator -->
     </NestedComparator>

   </Comparator>
 

Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Field Summary
 
Fields inherited from interface com.raritantechnologies.utils.comparators.IComparator
TEMPLATE
 
Constructor Summary
BeanPropertyComparator()
           
BeanPropertyComparator(java.lang.String childGetMethod, BeanPropertyComparator childBeanComp)
           
BeanPropertyComparator(java.lang.String getMethodName, java.util.Comparator stringComp)
           
BeanPropertyComparator(java.lang.String getMethodName, java.lang.String getMethodValue)
           
 
Method Summary
 int compare(java.lang.Object ob1, java.lang.Object ob2)
           
 boolean equals(java.lang.Object object)
           
 java.util.Comparator getComparator()
           
 java.lang.String getConfigurationXML()
           
 java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
           
 void getConfigurationXML(java.io.Writer writer)
           
 java.lang.String getGetMethodName()
           
 java.lang.String getGetMethodValue()
           
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 void setComparator(java.util.Comparator comparator)
           
 void setGetMethodName(java.lang.String getMethodName)
           
 void setGetMethodValue(java.lang.String getMethodValue)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPropertyComparator

public BeanPropertyComparator()

BeanPropertyComparator

public BeanPropertyComparator(java.lang.String getMethodName,
                              java.lang.String getMethodValue)

BeanPropertyComparator

public BeanPropertyComparator(java.lang.String getMethodName,
                              java.util.Comparator stringComp)

BeanPropertyComparator

public BeanPropertyComparator(java.lang.String childGetMethod,
                              BeanPropertyComparator childBeanComp)
Method Detail

equals

public boolean equals(java.lang.Object object)
Specified by:
equals in interface java.util.Comparator

compare

public int compare(java.lang.Object ob1,
                   java.lang.Object ob2)
Specified by:
compare in interface java.util.Comparator

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable

setGetMethodName

public void setGetMethodName(java.lang.String getMethodName)

getGetMethodName

public java.lang.String getGetMethodName()

setGetMethodValue

public void setGetMethodValue(java.lang.String getMethodValue)

getGetMethodValue

public java.lang.String getGetMethodValue()

setComparator

public void setComparator(java.util.Comparator comparator)

getComparator

public java.util.Comparator getComparator()

getConfigurationXML

public void getConfigurationXML(java.io.Writer writer)
                         throws java.io.IOException
Throws:
java.io.IOException

getConfigurationXML

public java.lang.String getConfigurationXML()

getConfigurationXML

public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)