Clone the Font and ParagraphFormat properties using Java

Hi,

In my application i have to store the builder font and paragraph format to some variable (So assign variable by value not by reference). And then will change the builder font and paragraph format values. And again i have to restore the stored font and paragraph format back to builder. But because of java reference copy Once i change the builder font, assigned variable also will change. So Please suggest a way to clone this both object.

Thank you

@Gptrnt

Please note that DocumentBuilder.ParagraphFormat and DocumentBuilder.Font properties do not have set property. However, you can read all properties of ParagraphFormat and Font classes, save them into separate variables, and use them according to your requirement later in the code.