[Index]

Concepts


Value concepts for defined, invalid, empty and undefined values.

There are some basic concepts on how values are intrepeted by the framework, which is important to understand.
A PropertyIO, retrieves a value as string by its name as string.

PropertyIO gets value by the name. Possible values Is Property Valid? The value returned
is not null A value which PropertyType
will validate.
TRUE Object of type T
A value which PropertyType
will NOT validate.
FALSE null
Empty string.
Empty string after trim.
TRUE/FALSE Special case with an empty string or string only with white space.
For some PropertyTypes this is a valid value.
Like for a list of Strings, the empty value is just a empty list of strings.
is null Dependent is what allowNull
is set to on the Property.
If the PropertyType has a defaultValue and
PropertyFrameworkGlobals.doUseDefaultValues() is true,
than defaultValue is returned.
Otherwise null is returned.


When loading property with name "X", there some behaviour you will have to be aware about regarding validation and what the value will be.

When loading the value for "X" from your PropertyIO, you can either get a NULL or NON-NULL value.

If the value is NULL, it is per definition not defined.

We will only use the default value for PropertyType if the value is undefined, aka NULL.

You can see in the example below how the framework will behave accordingly to the definitions you have created.



Example with IntegerPropertyType

Properties
#Properties
#An valid integer, defined
A=42

#An invalid integer, defined
B=cow

#An invalid integer, empty but defined
C=

#Undefined integer
#D=
Property definitions
//Integer property, no default value, null not allowed.
Property<Integer> PX = new Property<Integer>("[name]", new IntegerPropertyType());

//Integer property, 25 as default value, null not allowed.
Property<Integer> PY = new Property<Integer>("[name]", new IntegerPropertyType(25));

//Integer property, 50 as default value, null allowed.
Property<Integer> PZ = new Property<Integer>("[name]", new IntegerPropertyType(50),true);

//Integer property, no default value, null allowed.
Property<Integer> PW = new Property<Integer>("[name]", new IntegerPropertyType(),true);



  Setup Validation result for property (the value) getTypedValue() result for property (the value)
# Property Default value allowNull PropertyFrameworkGlobals
doUseDefaultValues()
A (42) B (cow) C (empty) D (undef) A (42) B (cow) C (empty) D (undef)
01 PX null false true ok exception exception exception 42 null null null
02 PX null false false ok exception exception exception 42 null null null
03 PY 25 false true ok exception exception exception 42 null null 25
04 PY 25 false false ok exception exception exception 42 null null null
05 PZ 50 true true ok exception exception ok 42 null null 50
06 PZ 50 true false ok exception exception ok 42 null null null
07 PW null true true ok exception exception ok 42 null null null
08 PW null true false ok exception exception ok 42 null null null