You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2015/05/05 23:03:25 UTC
svn commit: r1677889 - in
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive:
measurement/ pagenavigation/
Author: tilman
Date: Tue May 5 21:03:24 2015
New Revision: 1677889
URL: http://svn.apache.org/r1677889
Log:
PDFBOX-2783: Use getCOSObject() instead of getDictionary()
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDMeasureDictionary.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDNumberFormatDictionary.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDRectlinearMeasureDictionary.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDViewportDictionary.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThread.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThreadBead.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDMeasureDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDMeasureDictionary.java?rev=1677889&r1=1677888&r2=1677889&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDMeasureDictionary.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDMeasureDictionary.java Tue May 5 21:03:24 2015
@@ -32,7 +32,7 @@ public class PDMeasureDictionary impleme
*/
public static final String TYPE = "Measure";
- private COSDictionary measureDictionary;
+ private final COSDictionary measureDictionary;
/**
* Constructor.
@@ -40,7 +40,7 @@ public class PDMeasureDictionary impleme
protected PDMeasureDictionary()
{
this.measureDictionary = new COSDictionary();
- this.getDictionary().setName(COSName.TYPE, TYPE);
+ this.getCOSObject().setName(COSName.TYPE, TYPE);
}
/**
@@ -54,19 +54,12 @@ public class PDMeasureDictionary impleme
}
/**
- * {@inheritDoc}
- */
- public COSBase getCOSObject()
- {
- return this.measureDictionary;
- }
-
- /**
* This will return the corresponding dictionary.
*
* @return the measure dictionary
*/
- public COSDictionary getDictionary()
+ @Override
+ public COSDictionary getCOSObject()
{
return this.measureDictionary;
}
@@ -89,7 +82,7 @@ public class PDMeasureDictionary impleme
public String getSubtype()
{
- return this.getDictionary().getNameAsString(COSName.SUBTYPE,
+ return this.getCOSObject().getNameAsString(COSName.SUBTYPE,
PDRectlinearMeasureDictionary.SUBTYPE);
}
@@ -99,7 +92,7 @@ public class PDMeasureDictionary impleme
*/
protected void setSubtype(String subtype)
{
- this.getDictionary().setName(COSName.SUBTYPE, subtype);
+ this.getCOSObject().setName(COSName.SUBTYPE, subtype);
}
}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDNumberFormatDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDNumberFormatDictionary.java?rev=1677889&r1=1677888&r2=1677889&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDNumberFormatDictionary.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDNumberFormatDictionary.java Tue May 5 21:03:24 2015
@@ -81,19 +81,12 @@ public class PDNumberFormatDictionary im
}
/**
- * {@inheritDoc}
- */
- public COSBase getCOSObject()
- {
- return this.numberFormatDictionary;
- }
-
- /**
* This will return the dictionary.
*
* @return the number format dictionary
*/
- public COSDictionary getDictionary()
+ @Override
+ public COSDictionary getCOSObject()
{
return this.numberFormatDictionary;
}
@@ -116,7 +109,7 @@ public class PDNumberFormatDictionary im
*/
public String getUnits()
{
- return this.getDictionary().getString("U");
+ return this.getCOSObject().getString("U");
}
/**
@@ -126,7 +119,7 @@ public class PDNumberFormatDictionary im
*/
public void setUnits(String units)
{
- this.getDictionary().setString("U", units);
+ this.getCOSObject().setString("U", units);
}
/**
@@ -136,7 +129,7 @@ public class PDNumberFormatDictionary im
*/
public float getConversionFactor()
{
- return this.getDictionary().getFloat("C");
+ return this.getCOSObject().getFloat("C");
}
/**
@@ -146,7 +139,7 @@ public class PDNumberFormatDictionary im
*/
public void setConversionFactor(float conversionFactor)
{
- this.getDictionary().setFloat("C", conversionFactor);
+ this.getCOSObject().setFloat("C", conversionFactor);
}
/**
@@ -156,7 +149,7 @@ public class PDNumberFormatDictionary im
*/
public String getFractionalDisplay()
{
- return this.getDictionary().getString("F", FRACTIONAL_DISPLAY_DECIMAL);
+ return this.getCOSObject().getString("F", FRACTIONAL_DISPLAY_DECIMAL);
}
/**
@@ -172,7 +165,7 @@ public class PDNumberFormatDictionary im
|| FRACTIONAL_DISPLAY_ROUND.equals(fractionalDisplay)
|| FRACTIONAL_DISPLAY_TRUNCATE.equals(fractionalDisplay))
{
- this.getDictionary().setString("F", fractionalDisplay);
+ this.getCOSObject().setString("F", fractionalDisplay);
}
else
{
@@ -187,7 +180,7 @@ public class PDNumberFormatDictionary im
*/
public int getDenominator()
{
- return this.getDictionary().getInt("D");
+ return this.getCOSObject().getInt("D");
}
/**
@@ -197,7 +190,7 @@ public class PDNumberFormatDictionary im
*/
public void setDenominator(int denominator)
{
- this.getDictionary().setInt("D", denominator);
+ this.getCOSObject().setInt("D", denominator);
}
/**
@@ -207,7 +200,7 @@ public class PDNumberFormatDictionary im
*/
public boolean isFD()
{
- return this.getDictionary().getBoolean("FD", false);
+ return this.getCOSObject().getBoolean("FD", false);
}
/**
@@ -217,7 +210,7 @@ public class PDNumberFormatDictionary im
*/
public void setFD(boolean fd)
{
- this.getDictionary().setBoolean("FD", fd);
+ this.getCOSObject().setBoolean("FD", fd);
}
/**
@@ -227,7 +220,7 @@ public class PDNumberFormatDictionary im
*/
public String getThousandsSeparator()
{
- return this.getDictionary().getString("RT", ",");
+ return this.getCOSObject().getString("RT", ",");
}
/**
@@ -237,7 +230,7 @@ public class PDNumberFormatDictionary im
*/
public void setThousandsSeparator(String thousandsSeparator)
{
- this.getDictionary().setString("RT", thousandsSeparator);
+ this.getCOSObject().setString("RT", thousandsSeparator);
}
/**
@@ -247,7 +240,7 @@ public class PDNumberFormatDictionary im
*/
public String getDecimalSeparator()
{
- return this.getDictionary().getString("RD", ".");
+ return this.getCOSObject().getString("RD", ".");
}
/**
@@ -257,7 +250,7 @@ public class PDNumberFormatDictionary im
*/
public void setDecimalSeparator(String decimalSeparator)
{
- this.getDictionary().setString("RD", decimalSeparator);
+ this.getCOSObject().setString("RD", decimalSeparator);
}
/**
@@ -266,7 +259,7 @@ public class PDNumberFormatDictionary im
*/
public String getLabelPrefixString()
{
- return this.getDictionary().getString("PS", " ");
+ return this.getCOSObject().getString("PS", " ");
}
/**
@@ -275,7 +268,7 @@ public class PDNumberFormatDictionary im
*/
public void setLabelPrefixString(String labelPrefixString)
{
- this.getDictionary().setString("PS", labelPrefixString);
+ this.getCOSObject().setString("PS", labelPrefixString);
}
/**
@@ -285,7 +278,7 @@ public class PDNumberFormatDictionary im
*/
public String getLabelSuffixString()
{
- return this.getDictionary().getString("SS", " ");
+ return this.getCOSObject().getString("SS", " ");
}
/**
@@ -295,7 +288,7 @@ public class PDNumberFormatDictionary im
*/
public void setLabelSuffixString(String labelSuffixString)
{
- this.getDictionary().setString("SS", labelSuffixString);
+ this.getCOSObject().setString("SS", labelSuffixString);
}
/**
@@ -305,7 +298,7 @@ public class PDNumberFormatDictionary im
*/
public String getLabelPositionToValue()
{
- return this.getDictionary().getString("O", LABEL_SUFFIX_TO_VALUE);
+ return this.getCOSObject().getString("O", LABEL_SUFFIX_TO_VALUE);
}
/**
@@ -320,7 +313,7 @@ public class PDNumberFormatDictionary im
|| LABEL_PREFIX_TO_VALUE.equals(labelPositionToValue)
|| LABEL_SUFFIX_TO_VALUE.equals(labelPositionToValue))
{
- this.getDictionary().setString("O", labelPositionToValue);
+ this.getCOSObject().setString("O", labelPositionToValue);
}
else
{
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDRectlinearMeasureDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDRectlinearMeasureDictionary.java?rev=1677889&r1=1677888&r2=1677889&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDRectlinearMeasureDictionary.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDRectlinearMeasureDictionary.java Tue May 5 21:03:24 2015
@@ -57,7 +57,7 @@ public class PDRectlinearMeasureDictiona
*/
public String getScaleRatio()
{
- return this.getDictionary().getString(COSName.R);
+ return this.getCOSObject().getString(COSName.R);
}
/**
@@ -67,7 +67,7 @@ public class PDRectlinearMeasureDictiona
*/
public void setScaleRatio(String scaleRatio)
{
- this.getDictionary().setString(COSName.R, scaleRatio);
+ this.getCOSObject().setString(COSName.R, scaleRatio);
}
/**
@@ -77,7 +77,7 @@ public class PDRectlinearMeasureDictiona
*/
public PDNumberFormatDictionary[] getChangeXs()
{
- COSArray x = (COSArray)this.getDictionary().getDictionaryObject("X");
+ COSArray x = (COSArray)this.getCOSObject().getDictionaryObject("X");
if (x != null)
{
PDNumberFormatDictionary[] retval =
@@ -104,7 +104,7 @@ public class PDRectlinearMeasureDictiona
{
array.add(changeX);
}
- this.getDictionary().setItem("X", array);
+ this.getCOSObject().setItem("X", array);
}
/**
@@ -114,7 +114,7 @@ public class PDRectlinearMeasureDictiona
*/
public PDNumberFormatDictionary[] getChangeYs()
{
- COSArray y = (COSArray)this.getDictionary().getDictionaryObject("Y");
+ COSArray y = (COSArray)this.getCOSObject().getDictionaryObject("Y");
if (y != null)
{
PDNumberFormatDictionary[] retval =
@@ -141,7 +141,7 @@ public class PDRectlinearMeasureDictiona
{
array.add(changeY);
}
- this.getDictionary().setItem("Y", array);
+ this.getCOSObject().setItem("Y", array);
}
/**
@@ -151,7 +151,7 @@ public class PDRectlinearMeasureDictiona
*/
public PDNumberFormatDictionary[] getDistances()
{
- COSArray d = (COSArray)this.getDictionary().getDictionaryObject("D");
+ COSArray d = (COSArray)this.getCOSObject().getDictionaryObject("D");
if (d != null)
{
PDNumberFormatDictionary[] retval =
@@ -178,7 +178,7 @@ public class PDRectlinearMeasureDictiona
{
array.add(distance);
}
- this.getDictionary().setItem("D", array);
+ this.getCOSObject().setItem("D", array);
}
/**
@@ -188,7 +188,7 @@ public class PDRectlinearMeasureDictiona
*/
public PDNumberFormatDictionary[] getAreas()
{
- COSArray a = (COSArray)this.getDictionary().getDictionaryObject(COSName.A);
+ COSArray a = (COSArray)this.getCOSObject().getDictionaryObject(COSName.A);
if (a != null)
{
PDNumberFormatDictionary[] retval =
@@ -215,7 +215,7 @@ public class PDRectlinearMeasureDictiona
{
array.add(area);
}
- this.getDictionary().setItem(COSName.A, array);
+ this.getCOSObject().setItem(COSName.A, array);
}
/**
@@ -225,7 +225,7 @@ public class PDRectlinearMeasureDictiona
*/
public PDNumberFormatDictionary[] getAngles()
{
- COSArray t = (COSArray)this.getDictionary().getDictionaryObject("T");
+ COSArray t = (COSArray)this.getCOSObject().getDictionaryObject("T");
if (t != null)
{
PDNumberFormatDictionary[] retval =
@@ -252,7 +252,7 @@ public class PDRectlinearMeasureDictiona
{
array.add(angle);
}
- this.getDictionary().setItem("T", array);
+ this.getCOSObject().setItem("T", array);
}
/**
@@ -262,7 +262,7 @@ public class PDRectlinearMeasureDictiona
*/
public PDNumberFormatDictionary[] getLineSloaps()
{
- COSArray s = (COSArray)this.getDictionary().getDictionaryObject("S");
+ COSArray s = (COSArray)this.getCOSObject().getDictionaryObject("S");
if (s != null)
{
PDNumberFormatDictionary[] retval =
@@ -289,7 +289,7 @@ public class PDRectlinearMeasureDictiona
{
array.add(lineSloap);
}
- this.getDictionary().setItem("S", array);
+ this.getCOSObject().setItem("S", array);
}
/**
@@ -299,7 +299,7 @@ public class PDRectlinearMeasureDictiona
*/
public float[] getCoordSystemOrigin()
{
- COSArray o = (COSArray)this.getDictionary().getDictionaryObject("O");
+ COSArray o = (COSArray)this.getCOSObject().getDictionaryObject("O");
if (o != null)
{
return o.toFloatArray();
@@ -316,7 +316,7 @@ public class PDRectlinearMeasureDictiona
{
COSArray array = new COSArray();
array.setFloatArray(coordSystemOrigin);
- this.getDictionary().setItem("O", array);
+ this.getCOSObject().setItem("O", array);
}
/**
@@ -326,7 +326,7 @@ public class PDRectlinearMeasureDictiona
*/
public float getCYX()
{
- return this.getDictionary().getFloat("CYX");
+ return this.getCOSObject().getFloat("CYX");
}
/**
@@ -336,7 +336,7 @@ public class PDRectlinearMeasureDictiona
*/
public void setCYX(float cyx)
{
- this.getDictionary().setFloat("CYX", cyx);
+ this.getCOSObject().setFloat("CYX", cyx);
}
}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDViewportDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDViewportDictionary.java?rev=1677889&r1=1677888&r2=1677889&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDViewportDictionary.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDViewportDictionary.java Tue May 5 21:03:24 2015
@@ -56,19 +56,12 @@ public class PDViewportDictionary implem
}
/**
- * {@inheritDoc}
- */
- public COSBase getCOSObject()
- {
- return this.viewportDictionary;
- }
-
- /**
* This will return the corresponding dictionary.
*
* @return the viewport dictionary
*/
- public COSDictionary getDictionary()
+ @Override
+ public COSDictionary getCOSObject()
{
return this.viewportDictionary;
}
@@ -91,7 +84,7 @@ public class PDViewportDictionary implem
*/
public PDRectangle getBBox()
{
- COSArray bbox = (COSArray)this.getDictionary().getDictionaryObject("BBox");
+ COSArray bbox = (COSArray)this.getCOSObject().getDictionaryObject("BBox");
if (bbox != null)
{
return new PDRectangle(bbox);
@@ -106,7 +99,7 @@ public class PDViewportDictionary implem
*/
public void setBBox(PDRectangle rectangle)
{
- this.getDictionary().setItem("BBox", rectangle);
+ this.getCOSObject().setItem("BBox", rectangle);
}
/**
@@ -116,7 +109,7 @@ public class PDViewportDictionary implem
*/
public String getName()
{
- return this.getDictionary().getNameAsString(COSName.NAME);
+ return this.getCOSObject().getNameAsString(COSName.NAME);
}
/**
@@ -126,7 +119,7 @@ public class PDViewportDictionary implem
*/
public void setName(String name)
{
- this.getDictionary().setName(COSName.NAME, name);
+ this.getCOSObject().setName(COSName.NAME, name);
}
/**
@@ -136,7 +129,7 @@ public class PDViewportDictionary implem
*/
public PDMeasureDictionary getMeasure()
{
- COSDictionary measure = (COSDictionary)this.getDictionary().getDictionaryObject("Measure");
+ COSDictionary measure = (COSDictionary)this.getCOSObject().getDictionaryObject("Measure");
if (measure != null)
{
return new PDMeasureDictionary(measure);
@@ -151,7 +144,7 @@ public class PDViewportDictionary implem
*/
public void setMeasure(PDMeasureDictionary measure)
{
- this.getDictionary().setItem("Measure", measure);
+ this.getCOSObject().setItem("Measure", measure);
}
}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThread.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThread.java?rev=1677889&r1=1677888&r2=1677889&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThread.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThread.java Tue May 5 21:03:24 2015
@@ -58,17 +58,8 @@ public class PDThread implements COSObje
*
* @return The underlying info dictionary.
*/
- public COSDictionary getDictionary()
- {
- return thread;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
+ @Override
+ public COSDictionary getCOSObject()
{
return thread;
}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThreadBead.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThreadBead.java?rev=1677889&r1=1677888&r2=1677889&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThreadBead.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThreadBead.java Tue May 5 21:03:24 2015
@@ -34,7 +34,7 @@ public class PDThreadBead implements COS
{
- private COSDictionary bead;
+ private final COSDictionary bead;
/**
* Constructor that is used for a preexisting dictionary.
@@ -63,17 +63,8 @@ public class PDThreadBead implements COS
*
* @return The underlying info dictionary.
*/
- public COSDictionary getDictionary()
- {
- return bead;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
+ @Override
+ public COSDictionary getCOSObject()
{
return bead;
}
@@ -122,7 +113,7 @@ public class PDThreadBead implements COS
*
* @param next The next bead.
*/
- protected void setNextBead( PDThreadBead next )
+ protected final void setNextBead( PDThreadBead next )
{
bead.setItem( "N", next );
}
@@ -143,7 +134,7 @@ public class PDThreadBead implements COS
*
* @param previous The previous bead.
*/
- protected void setPreviousBead( PDThreadBead previous )
+ protected final void setPreviousBead( PDThreadBead previous )
{
bead.setItem( "V", previous );
}