commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vihung Marathe" <>
Subject Suggestion for Clone Builder in commons-lang to assist with Cloneable and clone()
Date Tue, 21 Aug 2007 15:52:26 GMT
Given that it is considered 'good practice' for entity objects to be
Cloneable and to have a 'proper' clone() method, can I suggest that
there be a CloneBuilder builder along the lines of HashCodeBuilder et

I would expect to use it in my implementation of clone() methods as

  public Object clone() throws CloneNotSupportedException {
      return CloneBuilder.reflectionClone(this);

to use reflection to build a generic clone


  public Object clone() throws CloneNotSupportedException {
      return new CloneBuilder(this)
          .append("field1")         // note the 'field by name' usage
          .append("field2")         // rather than 'field by value'

to build a clone from specific named fields.

-- Vihung

This e-mail may contain confidential information and/or copyright material. This e-mail is
intended for the use of the addressee only. Any unauthorised use may be unlawful.

If you receive this e-mail by mistake please advise the sender immediately by using the reply
facility in your e-mail software.

The Friends Provident group of companies includes these Friends Provident plc subsidiary companies:

Friends Provident Life and Pensions Limited. Registered number 4096141.
Friends Provident Life Assurance Limited. Registered number 782698.
Friends Provident Pensions Limited. Registered number 475201.
Friends Provident Marketing Limited. Registered number 5059179.

Each of the above subsidiary companies is authorised and regulated by the Financial Services

Friends Provident Management Services Limited. Registered number 983330

The ultimate holding company is Friends Provident plc. Registered number 4113107.

All are incorporated companies limited by shares and registered in England.
Registered and Head Office: Pixham End, Dorking, Surrey RH4 1QA.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message