ERXProperties.InRangeOperator Class Reference

Inherits er::extensions::foundation::ERXProperties::Operator.

Collaboration diagram for ERXProperties.InRangeOperator:

Collaboration graph
[legend]

List of all members.

Public Member Functions

NSDictionary< String, Stringcompute (String key, String value, String parameters)
 InRangeOperator (int value)

Static Public Attributes

static final String ForInstanceKey = "forInstance"

Private Attributes

int _instanceNumber


Detailed Description

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

Constructor & Destructor Documentation

InRangeOperator ( int  value  ) 

Constructs a new InRangeOperator.

Parameters:
value the instance number of this application


Member Function Documentation

NSDictionary<String, String> compute ( String  key,
String  value,
String  parameters 
)

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.

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)

Implements ERXProperties.Operator.


Member Data Documentation

int _instanceNumber [private]

final String ForInstanceKey = "forInstance" [static]

The default key name of the ForInstance variant of the InRange operator.


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:13 2012 for Project Wonder by  doxygen 1.5.8