-2

I'm migrating from itext v5 to v7 and found the PdfSignatureAppearance class has changed its method setSignDate() from public to protected. I can't find the reason why is it necessary? (I know that protected method can only be used in inherited class or in the same package).

  1. Am I missing some good design patterns of java?

  2. should I make IpdfSignatureAppearance which inherit the PdfSignatureAppearance and call actual function

v5 https://api.itextpdf.com/iText5/5.5.13/

v7 https://api.itextpdf.com/iText7/java/7.0.4/

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
nil96
  • 313
  • 1
  • 3
  • 12
  • Guys before downvoting please mention the reason so that I can improve – nil96 Jan 28 '20 at 07:35
  • 1
    I haven't downvoted but I assume the downvoters read your question as an invitation to discuss the iText API design (off topic here), not as "How can I set the signing time when signing with iText 7?" (on topic here), and indeed your question looks more like the former than like the latter. – mkl Jan 28 '20 at 09:50
  • 1
    if you are going to move, I'd advise you move to iText 7.1.x instead of 7.0.x – André Lemos Jan 28 '20 at 10:30

1 Answers1

3

iText 5 to iText 7 has been a major overhaul, and even if a number of classes in iText 7 still have names known from iText 5, the functionality may have changed considerably or moved between classes.

For example in the case at hand, that method has become protected on 2015-10-29 09:05:58 in commit ba907ff8e40de9457ac08a2138a9a9732b6c7d68 with the comment

Refactored signatures module.

Moved the code related to the actual signing into separate class (PdfSigner). Removed unused methods.

Indeed, if you need to set the signing time in iText 7, you now do so in the associated PdfSigner instance using its public setSignDate method; that method in turn calls PdfSignatureAppearance.setSignDate among other things.

Community
  • 1
  • 1
mkl
  • 90,588
  • 15
  • 125
  • 265