Please consider the attached patch for the commons-beanutils2 project. I
added support for nested properties and automatic conversion. Excerpt
from AutoConversionTest:
*final* DateFormat dateFormat = *new* SimpleDateFormat("MMMM d, yyyy");
*final* TransformerRegistry transformerRegistry = *new*
TransformerRegistry()
.register(*new* StringToDate(dateFormat))
.register(*new* IntegerToString())
.register(*new* StringToColor())
.register(*new* IntegerToColor())
.register(*new* StringToURL())
.register(*new* StringToPhoneNumber());
*final* PhoneNumber phoneNumber = *new* PhoneNumber();
phoneNumber.setAreaCode("202");
phoneNumber.setPrefix("456");
phoneNumber.setLineNumber("1111");
*final* Address address = *new* Address();
address.setStreetAddress("1600 Pennsylvania Avenue Northwest");
address.setCity("Washington");
address.setStateCode("DC");
address.setPostalCode("20500");
address.setCountryCode("US");
*final* Person person = *new* Person();
person.setFirstName("Barack");
person.setLastName("Obama");
person.setBirthDate(dateFormat.parse("August 4, 1961"));
person.setEyeColor(Color.*decode*("#362819"));
person.setHairColor(*GRAY*);
person.setPhoneNumber(phoneNumber);
person.setAddress(address);
person.setWebsite(*new* URL("https://www.barackobama.com/"));
*assertEquals*(person, *on*(*new* Person(), transformerRegistry)
.set("firstName").with("Barack")
.set("lastName").with("Obama")
.set("birthDate").with("August 4, 1961")
.set("hairColor").with(0x808080)
.set("eyeColor").with("#362819")
.set("website").with("https://www.barackobama.com/")
.set("phoneNumber").with("202-456-1111")
.set("address").with(*new* Address())
.set("address.streetAddress").with("1600 Pennsylvania Avenue Northwest")
.set("address.city").with("Washington")
.set("address.stateCode").with("DC")
.set("address.postalCode").with(20500)
.set("address.countryCode").with("US")
.get());
Thanks,
Matt
On Sat, Oct 24, 2015 at 4:16 PM, Matthew Mann <[email protected]> wrote:
> When will BeanUtils2 be released? According to Benedikt Ritter: "One big
> part that is still missing is automatic conversion of values." Anything
> else?
>
> -Matt
>
> On Wed, Oct 7, 2015 at 1:22 PM, Benedikt Ritter <[email protected]>
> wrote:
>
>> Hello Matthew,
>>
>> sorry this took so long. We don't have a road map. There is not much
>> activity in BeanUtils2 at the moment. One big part that is still missing
>> is
>> automatic conversion of values. If you're interested to get involved in
>> the
>> development of BeanUtils 2, it's probably the best to reach out for other
>> developers on the dev ML. You can also look into the SANDBOX project in
>> the
>> ASF jira and filter for tickets with the BeanUtils2 component to see what
>> need work.
>>
>> Best regards,
>> Benedikt
>>
>> 2015-10-04 23:42 GMT+02:00 Matthew Mann <[email protected]>:
>>
>> > Please share the release road map with me? Or, is it online somewhere?
>> > Anything I can do to help?
>> >
>> > -Matt
>> >
>> > On Sat, Sep 26, 2015 at 6:31 PM, Matthew Mann <[email protected]>
>> > wrote:
>> >
>> > > Cool! Is the road map online somewhere?
>> > >
>> > > On Wed, Sep 23, 2015 at 9:17 AM, Benedikt Ritter <[email protected]>
>> > > wrote:
>> > >
>> > >> Woops, hit send to early...
>> > >>
>> > >> 2015-09-23 15:16 GMT+02:00 Benedikt Ritter <[email protected]>:
>> > >>
>> > >> >
>> > >> >
>> > >> > 2015-09-19 22:17 GMT+02:00 Matthew Mann <[email protected]>:
>> > >> >
>> > >> >> When will beanutils2 be released?
>> > >> >>
>> > >> >
>> > >> > There are now plans/release road map. The plan more features so
>> that
>> > it
>> > >> is
>> > >> > a real substitute to BeanUtils1.
>> > >> >
>> > >>
>> > >> Should be "the plan was to add more features..."
>> > >>
>> > >>
>> > >> >
>> > >> > Regards,
>> > >> > Benedikt
>> > >> >
>> > >> >
>> > >> >
>> > >> > --
>> > >> > http://people.apache.org/~britter/
>> > >> > http://www.systemoutprintln.de/
>> > >> > http://twitter.com/BenediktRitter
>> > >> > http://github.com/britter
>> > >> >
>> > >>
>> > >>
>> > >>
>> > >> --
>> > >> http://people.apache.org/~britter/
>> > >> http://www.systemoutprintln.de/
>> > >> http://twitter.com/BenediktRitter
>> > >> http://github.com/britter
>> > >>
>> > >
>> > >
>> >
>>
>>
>>
>> --
>> http://people.apache.org/~britter/
>> http://www.systemoutprintln.de/
>> http://twitter.com/BenediktRitter
>> http://github.com/britter
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]