You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Optional Properties should be treated in a special way to allow the distinction between
A user specifying a null value: some(new MyPojoBuilder().withSomeProperty((String) null));
No specification at all: some(new MyPojoBuilder());
Currently in both cases the constructor/static factory method is called with null. When using static factory methods to calculate dependened properties as described in #112 it is important to be able to differentiate the above cases.
This distinction is probably also relevant for #101.
This issue is also related to #92.
The example below shows what should be generated by PB.
This is not backwards compatible in all regards, because the following two methods were removed due to type erasure:
This feature is backwards compatible to #66 meaning that any call to a with method using Optional.absent() is effectively ignored. The semantics of the following optional call are unchanged.
In this case the constructor/setter/factory method will be called with null, regardless of whether the property is of type String or Optional<String>. In fact properties of type String and Optional<String> are treated almost identically. Missing user specification is represented by Optional.absent() for optional properties and the type dependened default value otherwise (0 for numbers, false for booleans, null for objects, etc.).
Optional Properties should be treated in a special way to allow the distinction between
some(new MyPojoBuilder().withSomeProperty((String) null));
some(new MyPojoBuilder());
Currently in both cases the constructor/static factory method is called with
null
. When using static factory methods to calculate dependened properties as described in #112 it is important to be able to differentiate the above cases.This distinction is probably also relevant for #101.
This issue is also related to #92.
The example below shows what should be generated by PB.
This is not backwards compatible in all regards, because the following two methods were removed due to type erasure:
This feature is backwards compatible to #66 meaning that any call to a with method using
Optional.absent()
is effectively ignored. The semantics of the following optional call are unchanged.However now it is also supported to supply
null
in an optional with method:In this case the constructor/setter/factory method will be called with
null
, regardless of whether the property is of typeString
orOptional<String>
. In fact properties of typeString
andOptional<String>
are treated almost identically. Missing user specification is represented byOptional.absent()
for optional properties and the type dependened default value otherwise (0
for numbers,false
for booleans,null
for objects, etc.).Shoud generate:
The text was updated successfully, but these errors were encountered: