简体   繁体   中英

Itext7 moving public method to protected

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/

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM