Author: tilman Date: Thu Feb 22 19:32:31 2018 New Revision: 1825092 URL: http://svn.apache.org/viewvc?rev=1825092&view=rev Log: PDFBOX-4071: make methods final that shouldn't be changed; make method protected that shouldn't be accessed outside of class hierarchy; move methods to base class
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationTextMarkup.java Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java?rev=1825092&r1=1825091&r2=1825092&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java Thu Feb 22 19:32:31 2018 @@ -216,6 +216,27 @@ public abstract class PDAnnotation imple } /** + * This will set the sub type (and hence appearance, AP taking precedence) For this annotation. See the SUB_TYPE_XXX + * constants for valid values. + * + * @param subType The subtype of the annotation + */ + protected final void setSubtype(String subType) + { + getCOSObject().setName(COSName.SUBTYPE, subType); + } + + /** + * This will retrieve the subtype of the annotation. + * + * @return The subtype of this annotation, see the SUB_TYPE_XXX constants. + */ + public final String getSubtype() + { + return getCOSObject().getNameAsString(COSName.SUBTYPE); + } + + /** * The annotation rectangle, defining the location of the annotation on the page in default user space units. This * is usually required and should not return null on valid PDF documents. But where this is a parent form field with * children, such as radio button collections then the rectangle will be null. @@ -765,16 +786,6 @@ public abstract class PDAnnotation imple } /** - * This will retrieve the subtype of the annotation. - * - * @return the subtype - */ - public String getSubtype() - { - return this.getCOSObject().getNameAsString(COSName.SUBTYPE); - } - - /** * This will set the corresponding page for this annotation. * * @param page is the corresponding page Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java?rev=1825092&r1=1825091&r2=1825092&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java Thu Feb 22 19:32:31 2018 @@ -135,29 +135,6 @@ public abstract class PDAnnotationSquare } } - //TODO setSubtype() and getSubtype() should move up? - /** - * This will set the sub type (and hence appearance, AP taking precedence) For this annotation. See the SUB_TYPE_XXX - * constants for valid values. - * - * @param subType The subtype of the annotation - */ - public void setSubtype(String subType) - { - getCOSObject().setName(COSName.SUBTYPE, subType); - } - - /** - * This will retrieve the sub type (and hence appearance, AP taking precedence) For this annotation. - * - * @return The subtype of this annotation, see the SUB_TYPE_XXX constants. - */ - @Override - public String getSubtype() - { - return getCOSObject().getNameAsString(COSName.SUBTYPE); - } - /** * This will set the border style dictionary, specifying the width and dash pattern used in drawing the line. * Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationTextMarkup.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationTextMarkup.java?rev=1825092&r1=1825091&r2=1825092&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationTextMarkup.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationTextMarkup.java Thu Feb 22 19:32:31 2018 @@ -79,29 +79,4 @@ public class PDAnnotationTextMarkup exte // Should never happen as this is a required item return null; } - - /** - * This will set the sub type (and hence appearance, AP taking precedence) For this annotation. - * See the SUB_TYPE constants in subclasses for valid values. - * - * @param subType The subtype of the annotation - */ - private void setSubtype(String subType) - { - getCOSObject().setName(COSName.SUBTYPE, subType); - } - - /** - * This will retrieve the sub type (and hence appearance, AP taking precedence) For this - * annotation. - * - * @return The subtype of this annotation, see the SUB_TYPE constants in subclasses for valid - * values. - */ - @Override - public String getSubtype() - { - return getCOSObject().getNameAsString(COSName.SUBTYPE); - } - }