org.kuali.rice.krms.framework.engine.expression
Class ComparisonOperatorServiceImpl

java.lang.Object
  extended by org.kuali.rice.krms.framework.engine.expression.ComparisonOperatorServiceImpl
All Implemented Interfaces:
ComparisonOperatorService, StringCoercionExtension

public class ComparisonOperatorServiceImpl
extends Object
implements ComparisonOperatorService

ComparisonOperatorService Implementation.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Method Summary
 boolean canCoerce(String type, String value)
          Can this StringCoercionExtension coerce the given type and value into an Object?
 boolean canCompare(Object lhs, Object rhs)
          Does the service have an Extension that can compare the given objects?
 Object coerce(String type, String value)
          Returns an Object of the given type populated with the given value.
 int compare(Object lhs, Object rhs)
          Returns the int result of a compare between the lhs and rhs objects.
 EngineComparatorExtension findComparatorExtension(Object lhs, Object rhs)
          Returns the EngineComparatorExtension that can compare the lhs and rhs objects.
 StringCoercionExtension findStringCoercionExtension(String type, String value)
          Returns the EngineComparatorExtension that can coerce the lhs and rhs objects.
static ComparisonOperatorService getInstance()
          Factory method for getting a ComparisonOperatorService
 List<EngineComparatorExtension> getOperators()
          The List of EngineComparatorExtensions.
 List<StringCoercionExtension> getStringCoercionExtensions()
           
 void setOperators(List<EngineComparatorExtension> operators)
          List to use.
 void setStringCoercionExtensions(List<StringCoercionExtension> stringCoercionExtensions)
          The List of StringCoercionExtensions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ComparisonOperatorService getInstance()
Factory method for getting a ComparisonOperatorService

Returns:
a ComparisonOperatorService

getStringCoercionExtensions

public List<StringCoercionExtension> getStringCoercionExtensions()
Specified by:
getStringCoercionExtensions in interface ComparisonOperatorService
Returns:
List

setStringCoercionExtensions

public void setStringCoercionExtensions(List<StringCoercionExtension> stringCoercionExtensions)
Description copied from interface: ComparisonOperatorService
The List of StringCoercionExtensions.

Specified by:
setStringCoercionExtensions in interface ComparisonOperatorService

getOperators

public List<EngineComparatorExtension> getOperators()
Description copied from interface: ComparisonOperatorService
The List of EngineComparatorExtensions.

Specified by:
getOperators in interface ComparisonOperatorService
Returns:
List of configured EngineComparatorExtensions.

setOperators

public void setOperators(List<EngineComparatorExtension> operators)
Description copied from interface: ComparisonOperatorService
List to use.

Specified by:
setOperators in interface ComparisonOperatorService

findComparatorExtension

public EngineComparatorExtension findComparatorExtension(Object lhs,
                                                         Object rhs)
Returns the EngineComparatorExtension that can compare the lhs and rhs objects. If none, then returns the DefaultComparisonOperator

Specified by:
findComparatorExtension in interface ComparisonOperatorService
Parameters:
lhs - left hand side object
rhs - right hand side object
Returns:
an EngineComparatorExtension that can compare the lhs and rhs

compare

public int compare(Object lhs,
                   Object rhs)
Description copied from interface: ComparisonOperatorService
Returns the int result of a compare between the lhs and rhs objects.

Specified by:
compare in interface ComparisonOperatorService
Parameters:
lhs - left hand side object
rhs - right hand side object
Returns:
int result of compare between lhs and rhs objects

canCompare

public boolean canCompare(Object lhs,
                          Object rhs)
Description copied from interface: ComparisonOperatorService
Does the service have an Extension that can compare the given objects?

Specified by:
canCompare in interface ComparisonOperatorService
Parameters:
lhs - left hand side Object
rhs - right hand side Object
Returns:
boolean true a configured EngineComparatorExtension can compare the lhs and rhs Objects.

findStringCoercionExtension

public StringCoercionExtension findStringCoercionExtension(String type,
                                                           String value)
Returns the EngineComparatorExtension that can coerce the lhs and rhs objects. If none, then returns the DefaultComparisonOperator, which also handles default coercion

Specified by:
findStringCoercionExtension in interface ComparisonOperatorService
Parameters:
type - class type to attempt to coerce to
value - value to attempt to coerce the given type with
Returns:
an EngineComparatorExtension that can coerce the type and value

canCoerce

public boolean canCoerce(String type,
                         String value)
Description copied from interface: StringCoercionExtension
Can this StringCoercionExtension coerce the given type and value into an Object?

Specified by:
canCoerce in interface ComparisonOperatorService
Specified by:
canCoerce in interface StringCoercionExtension
Parameters:
type - of Object to coerce to.
value - value to use for coerced type
Returns:
boolean true if this StringCoercionExtension can coerce this type and value

coerce

public Object coerce(String type,
                     String value)
Description copied from interface: StringCoercionExtension
Returns an Object of the given type populated with the given value.

Specified by:
coerce in interface ComparisonOperatorService
Specified by:
coerce in interface StringCoercionExtension
Parameters:
type - to coerce Object to
value - to coerce
Returns:
Object of given type with given value


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.