Skip to content

Quick Reference: Core

padrig64 edited this page Nov 30, 2014 · 16 revisions

This page gives a quick overview and description of all entities of the ValidationFramework.

Triggers

Triggers start the validation process when validation is needed.

Here is a list of all concrete triggers available in the [validationframework-core] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-core/src/main/java/com/google/code/validationframework/base) module:

Trigger Description
AbstractTrigger Convenient base class that can be used for any trigger.
CompositeTrigger Triggered whenever any of its embedded triggers are triggered.
ManualTrigger Triggered upon call to fireTriggerEvent().
PropertyChangeTrigger Implementing the PropertyChangeListener ins, triggered whenever the registered properties change.
ResultCollector Triggered whenever it processes the result of another validator.

Data providers

Data provides retrieve the data to be validation the triggers are initiated.

Here is a list of all concrete data providers available in the [validationframework-core] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-core/src/main/java/com/google/code/validationframework/base) module:

Data provider Output Description
ListCompositeDataProvider List<DPO> Provides a list of output from wrapped data providers.
MapCompositeDataProvider Map<K, DPO> Provides a map of output from wrapped data providers associated with keys.
ResultCollector <RHI> Provides the result of a previously triggered validation.
TransformedDataProvider <TDPO> Transforms the output of a wrapped data provider.

Rules

Rules validate the data from the data providers and produce results.

Here is a list of all concrete rules available in the [validationframework-core] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-core/src/main/java/com/google/code/validationframework/base) module:

Rule Input Output Description
AggregatorRule Collection<RI> <RO>
AndBooleanRule Collection<Boolean> Boolean
AndCompositeBooleanRule <RI> Boolean
EqualsRule <RI> Boolean Checks whether the input object is equal to a specified object.
NegateBooleanRule <RI> Boolean Negates the boolean result of a wrapped rule.
NotNullBooleanRule Object Boolean
NullBooleanRule Object Boolean
NumberEqualToRule Number Boolean
NumberGreaterThanOrEqualToRule Number Boolean
NumberGreaterThanRule Number Boolean
NumberLessThanOrEqualToRule Number Boolean
NumberLessThanRule Number Boolean
OrBooleanRule Collection<Boolean> Boolean
OrCompositeBooleanRule <RI> Boolean
StringLengthEqualToRule String Boolean
StringLengthGreaterThanOrEqualToRule String Boolean
StringLengthGreaterThanRule String Boolean
StringLengthLessThanOrEqualToRule String Boolean
StringLengthLessThanRule String Boolean
StringNotEmptyRule String Boolean Makes sure the input string is not empty.
StringRegexRule String Boolean
TransformerRule <RI> <RO>

Result handlers

Result handlers process the results of the rules.

Here is a list of all concrete result handlers available in the [validationframework-core] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-core/src/main/java/com/google/code/validationframework/base) module:

Result handler Input Description
CompositeResultHandler <RHI>
PrintStreamResultHandler <RHI>
ResultCollector <RHI>
SimpleResultCollector <RHI>
TransformedResultHandler <RHI> Transforms the result and delegates its handling to a wrapped result handler.

Validators

Validators glue all triggers, data providers, rules and result handlers together.

Here is a list of all concrete validators available in the [validationframework-core] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-core/src/main/java/com/google/code/validationframework/base) module:

Validator Data provider output Rule input Rule output Result handler input Description
AndSimpleValidator <DPO> <DPO> Boolean Boolean Upon any trigger, each data provider will be used, each piece of data retrieved will be checked against all rules, all boolean results will be combined using the AND operator, and the combined result will be processed by all result handlers.
DefaultMappableValidator <DPO> <DPO> <RO> <RO> Upon any trigger, each data provider mapped to the initiated trigger will be used, each piece of data retrieved will be checked against each rule mapped to the data providers, each result will be processed by all result handlers mapped to the rules.
DefaultSimpleValidator <DPO> <DPO> <RO> <RO> Upon any trigger, each data providers will be used, each piece of data retrieved will be checked against each rule, each result will be processed by each result handler.
OrSimpleValidator <DPO> <DPO> Boolean Boolean Upon any trigger, all data providers will be used, all retrieved data will be checked against all rules, all boolean results will be combined using the AND operator, and the combined result will be processed by all result handlers.
ResultAggregationValidator <DPO> <DPO> <RO> <RHI> Upon any trigger, all data providers will be used, all retrieved data will be checked against all rules, all results will be combined using a specified aggregator (transformer), and the aggregated result will be processed by all result handlers.
ResultCollectorValidator <DPO> <DPO> <RO> <RO> Upon any trigger and any result produced by the rules collected from other validators, all data providers will used (including the result collectors giving the results from the other validators), all provided data will be gather into a collection and passed to all the rules, all results will be processed by all result handlers.
GeneralValidator <DPO> <RI> <RO> <RHI> All-purpose validator doing all the above and allowing to transform the data providers output, rules input, rules output and results handler input.

Properties

Properties can be used for many purposes, including the implementation of conditional logic.

Here is a list of all concrete properties available in the [validationframework-core] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-core/src/main/java/com/google/code/validationframework/base) module:

Property Read Write Description
AbstractReadableProperty <R> - Convenient abstract implementation of an inhibitable readable property.
AbstractReadableListProperty <R> - Convenient abstract implementation of a readable list property.
AbstractReadableMapProperty <R> - Convenient abstract implementation of a readable map property.
AbstractReadableSetProperty <R> - Convenient abstract implementation of a readable set property.
AbstractReadableWritableProperty <R> <W> Convenient abstract implementation of an inhibitable property that is both readable and writable.
AbstractReadableWritableListProperty <R> <W> Convenient abstract implementation of a list property that is both readable and writable.
AbstractReadableWritableMapProperty <R> <W> Convenient abstract implementation of a map property that is both readable and writable.
AbstractReadableWritableSetProperty <R> <W> Convenient abstract implementation of a set property that is both readable and writable.
CompositeReadableProperty Collection<R> - Property encapsulating other readable properties having values of a same type.
CompositeWritableProperty - <W> Property encapsulating other writable properties having values of a same type.
NegateBooleanPropertyWrapper Boolean - Wrapper to negate a boolean property.
ReadOnlyPropertyWrapper <R> - Wrapper to make a property read-only.
SimpleBooleanProperty Boolean Boolean SimpleProperty having a Boolean value.
SimpleByteProperty Byte Byte SimpleProperty having a Byte value.
SimpleCharacterProperty Character Character SimpleProperty having a Character value.
SimpleDoubleProperty Double Double SimpleProperty having a Double value.
SimpleFloatProperty Float Float SimpleProperty having a Float value.
SimpleFormatProperty Format Format SimpleProperty having a Format value.
SimpleIntegerProperty Integer Integer SimpleProperty having an Integer value.
SimpleListProperty <T> <T> Simple implementation of list property that is both readable and writable.
SimpleLongProperty Long Long SimpleProperty having a Long value.
SimpleMapProperty <T> <T> Simple implementation of map property that is both readable and writable.
SimpleNumberProperty Number Number SimpleProperty having a Number value.
SimpleObjectProperty Object Object SimpleProperty having an Object value.
SimpleProperty <T> <T> Simple implementation of a property that is both readable and writable.
SimpleSetProperty <T> <T> Simple implementation of set property that is both readable and writable.
SimpleShortProperty Short Short SimpleProperty having a Short value.
SimpleStringProperty String String SimpleProperty having a String value.

Transformers

Transformers can be used in some data providers, rules, result handlers and validators to convert or aggregate the manipulated data. They can also be used to transform properties.

Here is a list of all concrete transformers available in the [validationframework-core] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-core/src/main/java/com/google/code/validationframework/base) module:

Transformer Input Output Description
AndBooleanAggregator Collection<Boolean> Boolean Performs the AND operation with all input booleans of the collection.
CastTranformer <I> <O> Casts the input of type <I> to <O>.
ChainedTransformer <I> <O> Uses one or several transformers one after the other.
CollectionElementTransformer Collection<I> Collection<O> Transforms each element of the input collection using a specified element transformer.
ConstantTransformer <I> <O> Always returns the same specified value regardless of the input.
EqualsTransformer <I> Boolean Returns true if the input equals a specified value, false if it does not.
FormatTransformer <I> String Uses a Format object to format the input object and return the formatted string.
GetCollectionSizeTransformer Collection<?> Integer Returns the size of the input collection.
GetMapSizeTransformer Map<?, ?> Integer Returns the size of the input map.
NegateBooleanTransformer Boolean Boolean Negates the input boolean.
NotEqualsTransformer <I> Boolean Returns true if the input does not equal a specified value, false if it does.
NumberToByteTransformer Number Byte Converts a Number into a Byte.
NumberEqualToTransformer Number Boolean Returns true if the input number equals a specified value, false if it does not.
NumberToDoubleTransformer Number Double Converts a Number into a Double.
NumberToFloatTransformer Number Float Converts a Number into a Float.
NumberGreaterThanTransformer Number Boolean Returns true if the input number is strictly greater than a specified value, false otherwise.
NumberGreaterThanOrEqualToTransformer Number Boolean Returns true if the input number is greater than or equal to a specified value, false otherwise.
NumberLessThanTransformer Number Boolean Returns true if the input number is strictly less than a specified value, false otherwise.
NumberLessThanOrEqualToTransformer Number Boolean Returns true if the input number is less than or equal to a specified value, false otherwise.
NumberToIntegerTransformer Number Integer Converts a Number into an Integer.
NumberToLongTransformer Number Long Converts a Number into a Long.
NumberToShortTransformer Number Short Converts a Number into a Short.
OrBooleanAggregator Collection<Boolean> Boolean Performs the OR operation with all input booleans of the collection.
ParseTransformer String <O> Uses a Format object to parse the input string and return the parsed object.
ToStringTransformer <I> String Uses the toString() method of the input object of type <I>.
TrimTransformer String String Uses the trim() method of the input string.