1 /** 2 * Copyright (c) 2003, www.pdfbox.org 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 3. Neither the name of pdfbox; nor the names of its 14 * contributors may be used to endorse or promote products derived from this 15 * software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * http://www.pdfbox.org 29 * 30 */ 31 package org.pdfbox.cos; 32 33 import org.pdfbox.exceptions.COSVisitorException; 34 35 /** 36 * An interface for visiting a PDF document at the type (COS) level. 37 * 38 * @author Michael Traut 39 * @version $Revision: 1.6 $ 40 */ 41 public interface ICOSVisitor 42 { 43 /** 44 * Notification of visit to Array object. 45 * 46 * @param obj The Object that is being visited. 47 * @return any Object depending on the visitor implementation, or null 48 * @throws COSVisitorException If there is an error while visiting this object. 49 */ 50 public Object visitFromArray( COSArray obj ) throws COSVisitorException; 51 52 /** 53 * Notification of visit to boolean object. 54 * 55 * @param obj The Object that is being visited. 56 * @return any Object depending on the visitor implementation, or null 57 * @throws COSVisitorException If there is an error while visiting this object. 58 */ 59 public Object visitFromBoolean( COSBoolean obj ) throws COSVisitorException; 60 61 /** 62 * Notification of visit to dictionary object. 63 * 64 * @param obj The Object that is being visited. 65 * @return any Object depending on the visitor implementation, or null 66 * @throws COSVisitorException If there is an error while visiting this object. 67 */ 68 public Object visitFromDictionary( COSDictionary obj ) throws COSVisitorException; 69 70 /** 71 * Notification of visit to document object. 72 * 73 * @param obj The Object that is being visited. 74 * @return any Object depending on the visitor implementation, or null 75 * @throws COSVisitorException If there is an error while visiting this object. 76 */ 77 public Object visitFromDocument( COSDocument obj ) throws COSVisitorException; 78 79 /** 80 * Notification of visit to float object. 81 * 82 * @param obj The Object that is being visited. 83 * @return any Object depending on the visitor implementation, or null 84 * @throws COSVisitorException If there is an error while visiting this object. 85 */ 86 public Object visitFromFloat( COSFloat obj ) throws COSVisitorException; 87 88 /** 89 * Notification of visit to integer object. 90 * 91 * @param obj The Object that is being visited. 92 * @return any Object depending on the visitor implementation, or null 93 * @throws COSVisitorException If there is an error while visiting this object. 94 */ 95 public Object visitFromInt( COSInteger obj ) throws COSVisitorException; 96 97 /** 98 * Notification of visit to name object. 99 * 100 * @param obj The Object that is being visited. 101 * @return any Object depending on the visitor implementation, or null 102 * @throws COSVisitorException If there is an error while visiting this object. 103 */ 104 public Object visitFromName( COSName obj ) throws COSVisitorException; 105 106 /** 107 * Notification of visit to null object. 108 * 109 * @param obj The Object that is being visited. 110 * @return any Object depending on the visitor implementation, or null 111 * @throws COSVisitorException If there is an error while visiting this object. 112 */ 113 public Object visitFromNull( COSNull obj ) throws COSVisitorException; 114 115 /** 116 * Notification of visit to stream object. 117 * 118 * @param obj The Object that is being visited. 119 * @return any Object depending on the visitor implementation, or null 120 * @throws COSVisitorException If there is an error while visiting this object. 121 */ 122 public Object visitFromStream( COSStream obj ) throws COSVisitorException; 123 124 /** 125 * Notification of visit to string object. 126 * 127 * @param obj The Object that is being visited. 128 * @return any Object depending on the visitor implementation, or null 129 * @throws COSVisitorException If there is an error while visiting this object. 130 */ 131 public Object visitFromString( COSString obj ) throws COSVisitorException; 132 }