-
Sub-task
-
Resolution: Unresolved
-
P3
-
9
-
None
This issue has been filed to investigate the possibility of adding a static
validator(GetField) API to the deserialization process. Such an API could
be used to validate the stream fields before an instance of the object is
created.
A clear and easy to understand mechanism that can validate the deserialized
fields. Does not prevent the use of final fields, as the serialization framework
will be responsible for setting them. Something along the lines of what David
suggested:
private static void validate(GetField fields) {
if (fields.getInt("lo") > fields.getInt("hi")) { ... }
}
This could be a “special” method, or annotation driven. TBD.
Note: the validate method is static, so the object instance is not required to
be created before running the validation.
validator(GetField) API to the deserialization process. Such an API could
be used to validate the stream fields before an instance of the object is
created.
A clear and easy to understand mechanism that can validate the deserialized
fields. Does not prevent the use of final fields, as the serialization framework
will be responsible for setting them. Something along the lines of what David
suggested:
private static void validate(GetField fields) {
if (fields.getInt("lo") > fields.getInt("hi")) { ... }
}
This could be a “special” method, or annotation driven. TBD.
Note: the validate method is static, so the object instance is not required to
be created before running the validation.