Project Wonder 5.0

er.extensions.foundation
Class ERXProperties.InRangeOperator

java.lang.Object
  extended by er.extensions.foundation.ERXProperties.InRangeOperator
All Implemented Interfaces:
ERXProperties.Operator
Enclosing class:
ERXProperties

public static class ERXProperties.InRangeOperator
extends java.lang.Object
implements ERXProperties.Operator

InRangeOperator provides support for defining properties that only get set if a value falls within a specific range of values.

An example of this is instance-number-based properties, where you want to only set a specific value if the instance number of the application falls within a certain value. In this example, because instance number is something that is associated with a request rather than the application itself, it is up to the class registering this operator to specify which instance number this application is (via, for instance, a custom system property).

InRangeOperator supports specifying keys like:

er.extensions.akey.@forInstance.50=avalue

which would set the value of "er.extensions.akey" to "avalue" if this instance is 50.

er.extensions.akey.@forInstance.60,70=avalue

which would set the value of "er.extensions.akey" to "avalue" if this instance is 60 or 70.

er.extensions.akey.@forInstance.100-300=avalue

which would set the value of "er.extensions.akey" to "avalue" if this instance is between 100 and 300 (inclusive).

er.extensions.akey.@forInstance.20-30,500=avalue

which would set the value of "er.extensions.akey" to "avalue" if this instance is between 20 and 30 (inclusive), or if the instance is 50.

If there are multiple inRange operators that match for the same key, the last property (when sorted alphabetically by key name) will win. As a result, it's important to not define overlapping ranges, or you may get unexpected results.

Author:
mschrag

Field Summary
static java.lang.String ForInstanceKey
          The default key name of the ForInstance variant of the InRange operator.
 
Constructor Summary
ERXProperties.InRangeOperator(int value)
          Constructs a new InRangeOperator.
 
Method Summary
 com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.String> compute(java.lang.String key, java.lang.String value, java.lang.String parameters)
          Performs some computation on the key, value, and parameters and returns a dictionary of new properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ForInstanceKey

public static final java.lang.String ForInstanceKey
The default key name of the ForInstance variant of the InRange operator.

See Also:
Constant Field Values
Constructor Detail

ERXProperties.InRangeOperator

public ERXProperties.InRangeOperator(int value)
Constructs a new InRangeOperator.

Parameters:
value - the instance number of this application
Method Detail

compute

public com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.String> compute(java.lang.String key,
                                                                                         java.lang.String value,
                                                                                         java.lang.String parameters)
Description copied from interface: ERXProperties.Operator
Performs some computation on the key, value, and parameters and returns a dictionary of new properties. If this method returns null, the original key and value will be used. If any other dictionary is returned, the properties in the dictionary will be copied into the destination properties.

Specified by:
compute in interface ERXProperties.Operator
Parameters:
key - the key ("er.extensions.akey" in "er.extensions.akey.@someOperatorKey.aparameter=somevalue")
value - ("somevalue" in "er.extensions.akey.@someOperatorKey.aparameter=somevalue")
parameters - ("aparameter" in "er.extensions.akey.@someOperatorKey.aparameter=somevalue")
Returns:
a dictionary of properties (or null to use the original key and value)

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.