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.pdfviewer; 18 19 import org.apache.pdfbox.cos.COSName; 20 21 22 /** 23 * This is a simple class that will contain a key and a value. 24 * 25 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a> 26 * @version $Revision: 1.3 $ 27 */ 28 public class MapEntry 29 { 30 private Object key; 31 private Object value; 32 33 /** 34 * Get the key for this entry. 35 * 36 * @return The entry's key. 37 */ 38 public Object getKey() 39 { 40 return key; 41 } 42 43 /** 44 * This will set the key for this entry. 45 * 46 * @param k the new key for this entry. 47 */ 48 public void setKey(Object k) 49 { 50 key = k; 51 } 52 53 /** 54 * This will get the value for this entry. 55 * 56 * @return The value for this entry. 57 */ 58 public Object getValue() 59 { 60 return value; 61 } 62 63 /** 64 * This will set the value for this entry. 65 * 66 * @param val the new value for this entry. 67 */ 68 public void setValue(Object val) 69 { 70 this.value = val; 71 } 72 73 /** 74 * This will output a string representation of this class. 75 * 76 * @return A string representation of this class. 77 */ 78 public String toString() 79 { 80 String retval = null; 81 if( key instanceof COSName ) 82 { 83 retval = ((COSName)key).getName(); 84 } 85 else 86 { 87 retval = "" +key; 88 } 89 return retval; 90 } 91 }