Concepts |
|---|
| 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. |
| 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 |