pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1802414 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureNode.java
Date Wed, 19 Jul 2017 17:15:27 GMT
Author: tilman
Date: Wed Jul 19 17:15:27 2017
New Revision: 1802414

URL: http://svn.apache.org/viewvc?rev=1802414&view=rev
Log:
PDFBOX-2852: split long method

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureNode.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureNode.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureNode.java?rev=1802414&r1=1802413&r2=1802414&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureNode.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureNode.java
Wed Jul 19 17:15:27 2017
@@ -385,33 +385,35 @@ public abstract class PDStructureNode im
         }
         if (kidDic != null)
         {
-            String type = kidDic.getNameAsString(COSName.TYPE);
-            if ((type == null) || PDStructureElement.TYPE.equals(type))
-            {
-                // A structure element dictionary denoting another structure
-                // element
-                return new PDStructureElement(kidDic);
-            }
-            else if (PDObjectReference.TYPE.equals(type))
-            {
-                // An object reference dictionary denoting a PDF object
-                return new PDObjectReference(kidDic);
-            }
-            else if (PDMarkedContentReference.TYPE.equals(type))
-            {
-                // A marked-content reference dictionary denoting a
-                // marked-content sequence
-                return new PDMarkedContentReference(kidDic);
-            }
+            return createObjectFromDic(kidDic);
         }
         else if (kid instanceof COSInteger)
         {
-            // An integer marked-content identifier denoting a
-            // marked-content sequence
+            // An integer marked-content identifier denoting a marked-content sequence
             COSInteger mcid = (COSInteger) kid;
             return mcid.intValue();
         }
         return null;
     }
 
+    private COSObjectable createObjectFromDic(COSDictionary kidDic)
+    {
+        String type = kidDic.getNameAsString(COSName.TYPE);
+        if ((type == null) || PDStructureElement.TYPE.equals(type))
+        {
+            // A structure element dictionary denoting another structure element
+            return new PDStructureElement(kidDic);
+        }
+        else if (PDObjectReference.TYPE.equals(type))
+        {
+            // An object reference dictionary denoting a PDF object
+            return new PDObjectReference(kidDic);
+        }
+        else if (PDMarkedContentReference.TYPE.equals(type))
+        {
+            // A marked-content reference dictionary denoting a marked-content sequence
+            return new PDMarkedContentReference(kidDic);
+        }
+        return null;
+    }
 }



Mime
View raw message