Accessors

Accessors are Addons allowing to read and / or write data. They are specified by the mother interface IAccessor and the two sub interfaces IReadAccessor et IWriteAccessor.

MRules provides a panel of accessors addressing many use cases:

AVAILABLE : Checks if a property is available from the input / output beans, at Runtime. Returns a boolean value. Will be mainly used as a condition, with the automatic wrapping.

ABS : Computes the absolute value of one or more numbers.

COALESCE : Returns first non-null value in a List.

CONCATENATE : Concatenates character sequences.

CONDCOUNT : Counts verified (or unverified) conditions in a List.

CONDWRAPPER : Allows to retrieve condition evaluation result as a value. It’s automatically instanciated when needed.

COUNT : Counts items in a Collection, eventually depending on a condition.

DATEDIFF : Allows to compute difference between two dates. The target unit must be defined: “Y” (Year), “M” (Month), “D” (Day), “h” (Hour), “m” (Minute), “s” (Second), “z” (Milli).

DATEOP : Allows to add (or subtract) a duration to a date. This duration may be composed by several elements: Year, Month, Day, Hour, Minute, Second, Milli.

EXEWRAPPER : Allows to retrieve value returned by an executable. It’s automatically instanciated when needed.

FORMAT : Allows to format a String, in a way similar to Java Message Format.

ITERATE : Iterates on a Collection, an Array, etc.

MAPENTRIES : Retrieves a Collection of all entries in a Map.

MAPKEYS: Retrieves a Collection of all keys in a Map.

MAPVALUES : Retrieves a Collection of all values in a Map.

NEW : Instanciates a new Object.

NULLIFEMPTY : Returns null if red property is empty (character sequence, Collection, Map orarray).

PROPERTY : Reads or writes a property or subproperty of the input bean or of a variable

SEARCH : Finds the first item verifying a Condition in a List.

SIZE : Returns the size of a character sequence, a Collection, an array, …

SUBPART : Returns a sub part of a character sequence, a Collection, an array, …

TERNARY : Depending on the result of a condition evaluation, returns a value or anoother

VALUE : Specifies a constant value.

VPROPERTY : allows to access properties (input / output) with dynamical names, meaning unknown at compilation time.

Arithmetic Accessors handle simple mathematic operations. They might be used on 1 or more values. They are detailed below.

ADD : Performs a sum of numbers.

AVERAGE : Computes the average, eventually with coefficients, of numbers.

DIVIDE : Performs a division.

MOD : Computes a modulo.

MULTIPLY : Performs a multiplication.

POW : Computes an exponent.

ROUND : Rounds a number.

SUBTRACT : Performs a subtraction.

Accessors can be combined and nested to get the required value. They are responsible for transforming the value to conform to the expected type. (i.e. To write the boolean value “true” in its primitive form to an output object, if the original value is a String it will be automatically transformed).