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
Sometimes you might want to limit the builder to a subset of the pojo's properties.
It would be nice, if we could specify an inclusion and an exclusion pattern, that is used by PojoBuilder to select, which properties are generated into the builder.
The pattern itself should be able to select properties by their name and optionally by their type.
Pattern Syntax
The pattern syntax could look like this: <name pattern>[:<type pattern>]
where <name pattern> and <type pattern> are used to match the property's name and type.
The pattern syntaxt is some poor-man's regex allowing an asterisk * to match any character,
For example: *name would select surname, lastname, firstname, but not email.
And url:java.lang.String would select String url, but not URL url.
Sometimes you might want to limit the builder to a subset of the pojo's properties.
It would be nice, if we could specify an inclusion and an exclusion pattern, that is used by PojoBuilder to select, which properties are generated into the builder.
The pattern itself should be able to select properties by their name and optionally by their type.
Pattern Syntax
The pattern syntax could look like this:
<name pattern>[:<type pattern>]
where
<name pattern>
and<type pattern>
are used to match the property's name and type.The pattern syntaxt is some poor-man's regex allowing an asterisk
*
to match any character,For example:
*name
would selectsurname
,lastname
,firstname
, but notemail
.And
url:java.lang.String
would selectString url
, but notURL url
.Example: Inclusion
This would generate a builder having only firstname and surname as properties.
Example: Exclusion:
This would generate a builder having only email as property.
Example: Combination of Inclusion and Exclusion:
This would generate a builder having only
firstname
,surname
,login
, andemail
as properties, but notpassword
,notes
, andhomepage
.Limitations
Some limitations are, that only properties can be excluded, that are not part of the constructor or factory method arguments.
The text was updated successfully, but these errors were encountered: