1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.pdfbox.cos; 18 19 import org.apache.pdfbox.exceptions.COSVisitorException; 20 21 /** 22 * An interface for visiting a PDF document at the type (COS) level. 23 * 24 * @author Michael Traut 25 * @version $Revision: 1.6 $ 26 */ 27 public interface ICOSVisitor 28 { 29 /** 30 * Notification of visit to Array object. 31 * 32 * @param obj The Object that is being visited. 33 * @return any Object depending on the visitor implementation, or null 34 * @throws COSVisitorException If there is an error while visiting this object. 35 */ 36 public Object visitFromArray( COSArray obj ) throws COSVisitorException; 37 38 /** 39 * Notification of visit to boolean object. 40 * 41 * @param obj The Object that is being visited. 42 * @return any Object depending on the visitor implementation, or null 43 * @throws COSVisitorException If there is an error while visiting this object. 44 */ 45 public Object visitFromBoolean( COSBoolean obj ) throws COSVisitorException; 46 47 /** 48 * Notification of visit to dictionary object. 49 * 50 * @param obj The Object that is being visited. 51 * @return any Object depending on the visitor implementation, or null 52 * @throws COSVisitorException If there is an error while visiting this object. 53 */ 54 public Object visitFromDictionary( COSDictionary obj ) throws COSVisitorException; 55 56 /** 57 * Notification of visit to document object. 58 * 59 * @param obj The Object that is being visited. 60 * @return any Object depending on the visitor implementation, or null 61 * @throws COSVisitorException If there is an error while visiting this object. 62 */ 63 public Object visitFromDocument( COSDocument obj ) throws COSVisitorException; 64 65 /** 66 * Notification of visit to float object. 67 * 68 * @param obj The Object that is being visited. 69 * @return any Object depending on the visitor implementation, or null 70 * @throws COSVisitorException If there is an error while visiting this object. 71 */ 72 public Object visitFromFloat( COSFloat obj ) throws COSVisitorException; 73 74 /** 75 * Notification of visit to integer object. 76 * 77 * @param obj The Object that is being visited. 78 * @return any Object depending on the visitor implementation, or null 79 * @throws COSVisitorException If there is an error while visiting this object. 80 */ 81 public Object visitFromInt( COSInteger obj ) throws COSVisitorException; 82 83 /** 84 * Notification of visit to name object. 85 * 86 * @param obj The Object that is being visited. 87 * @return any Object depending on the visitor implementation, or null 88 * @throws COSVisitorException If there is an error while visiting this object. 89 */ 90 public Object visitFromName( COSName obj ) throws COSVisitorException; 91 92 /** 93 * Notification of visit to null object. 94 * 95 * @param obj The Object that is being visited. 96 * @return any Object depending on the visitor implementation, or null 97 * @throws COSVisitorException If there is an error while visiting this object. 98 */ 99 public Object visitFromNull( COSNull obj ) throws COSVisitorException; 100 101 /** 102 * Notification of visit to stream object. 103 * 104 * @param obj The Object that is being visited. 105 * @return any Object depending on the visitor implementation, or null 106 * @throws COSVisitorException If there is an error while visiting this object. 107 */ 108 public Object visitFromStream( COSStream obj ) throws COSVisitorException; 109 110 /** 111 * Notification of visit to string object. 112 * 113 * @param obj The Object that is being visited. 114 * @return any Object depending on the visitor implementation, or null 115 * @throws COSVisitorException If there is an error while visiting this object. 116 */ 117 public Object visitFromString( COSString obj ) throws COSVisitorException; 118 }